0

I've added this function to my .bashrc file:

SSH(){
    ssh -X -o PasswordAuthentication=yes root@10.222.22.$*
}

and while trying to perform for ex. SSH 101 I get message:

SSH: command not found

marked as duplicate by Gilles, Jeff Schaller, mdpc, G-Man, Thomas Dickey Sep 21 '16 at 1:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    .bashrc is read once you log in or spawn a new shell. Alternatively issue . ~/.bashrc to re-read it. – KWubbufetowicz Sep 20 '16 at 11:41
  • But it happens even after rebooting. – faketruth Sep 20 '16 at 11:58
  • What does type SSH output? – Costas Sep 20 '16 at 12:03
  • @Costas You mean typing SSH without argument? Also SSH: command not found. – faketruth Sep 20 '16 at 12:09
  • I mean command type with argument SSH – Costas Sep 20 '16 at 12:50
0

Are you using bash as your login shell? ps aux | grep $$

Some Linux Distros or UNIXes may not source ~/.bashrc but ~/.bash_profile. You could add source ~/.bashrc to your ~/.profile

Alternatively you could use ~/.ssh/config to add special settings for certain hosts, like this:

Host ? ?? ???
    User root
    HostName 10.222.22.%h
    PasswordAuthentication=yes
    ForwardX11=yes

And ssh 101 should do the same like your function SSH 101.

  • I've tried it both on root/normal user. – faketruth Sep 20 '16 at 13:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.