Link to home
Start Free TrialLog in
Avatar of David Sankovsky
David SankovskyFlag for Israel

asked on

Debian OS use Alias with parameter

Hi all.

I'm trying to make a bash alias with a parameter on my Debian (I'm very new to linux, so be gentle)
I'm trying to override the basic ssh <host> command with the following ssh -i <path to my dsa file> <host>.
I know I can basically edit the ssh_conf file t make it include my file anyways, but I'd still like to know wow to create the command as an alias in the bashrc file.
Avatar of Steven Vona
Steven Vona
Flag of United States of America image

Edit your .bashrc file (should be a hidden file in your home directory ex. /home/username/.bashrc) and add the following line:

alias ssh='ssh -i /path/to/dsa/ host'

But that will make it so everytime you type ssh it will connect to the same host. A better option would be to make a unique alias like so:

alias myss='ssh -i /path/to/dsa/ host'
ASKER CERTIFIED SOLUTION
Avatar of noci
noci

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David Sankovsky

ASKER

alias ssh='ssh -i /path/to/dsa/ host'

But that will make it so everytime you type ssh it will connect to the same host. A better option would be to make a unique alias like so:

alias myss='ssh -i /path/to/dsa/ host'
I may have explained wrong, I meant for the hot to be passed along as an argument.

Why not;

alias ssh='ssh -i /path/to/dsa '

Well, now I just feel dumb for not thinking about it...
kinda obvious when i think about it...