[SOLVED] Alias and sshpass

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Screatch

[SOLVED] Alias and sshpass

Post by Screatch »

I am trying to make an alias out of sshpass command (sshpass is a tool to make logging into a server only with a password).

Command itself looks something like this and works perfectly well by itself, but when i try to make alias out of it, it goes all wrong.

alias servername='sshpass -p '<7f%97BcA!/' ssh root@serverip'

then i restarted .bashrc, tried out my alias and i got
bash: 7f%97BcA!/ ssh root@serverip: No such file or directory

I figured out it's because of "<" symbol in the password, is there anyway to make alias ignore this symbols and just make him think its part of password, not as some command for alias, without me changing the server password.

Thanks in advance.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
unexistance

Re: Alias and sshpass

Post by unexistance »

Hi,

You'll need to escape it (put \ before the character)

p/s: Is it OK for all of us to know your server's password?

Regards,
Screatch

Re: Alias and sshpass

Post by Screatch »

Thanks!

Works as a charm.

And yes it's okay cause it's not really my server password :P Changed it, this is just an example.
Locked

Return to “Software & Applications”