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.
[SOLVED] Alias and sshpass
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
[SOLVED] Alias and sshpass
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.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Alias and sshpass
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,
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,
Re: Alias and sshpass
Thanks!
Works as a charm.
And yes it's okay cause it's not really my server password Changed it, this is just an example.
Works as a charm.
And yes it's okay cause it's not really my server password Changed it, this is just an example.