LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   ssh short way to access remote host? (https://www.linuxquestions.org/questions/linux-software-2/ssh-short-way-to-access-remote-host-4175446367/)

miros84 01-19-2013 12:57 PM

ssh short way to access remote host?
 
Now, to access some remote access I use

Code:

ssh -p 1000 10.10.10.10
Is there any way to access only that way?

Code:

ssh myremotehost

spiky0011 01-19-2013 02:27 PM

Hi

I just made a little script

Code:

#!/bin/bash
ssh -p port user@ip

I saved it in user/bin named it server and made executable
to run it I just type server

unSpawn 01-19-2013 03:37 PM

This is probably easier:
Code:

echo -en "Host myremotehost"\nHostName 10.10.10.10\nPort 1000\n" >> ~/.ssh/config

miros84 01-19-2013 04:10 PM

Where is config file? In /home/user/config?

If yes, I havenot got that folder created there.

headrift 01-19-2013 05:44 PM

Similarly but differently, I use aliases. In /home/user:

Code:

echo "alias myremotehost=\"ssh 10.10.10.10 -p 1000\"" >> .bashrc
...and then type "source .bashrc" to refresh the prompt (or logout and back in). From there, just type "myremotehost" at the prompt for that user. Works pretty well.

descendant_command 01-19-2013 06:00 PM

Well you can use a wrench for a hammer if you want, but that is exactly what ~/.ssh/config is for.

miros84 01-20-2013 03:24 AM

Quote:

Originally Posted by descendant_command (Post 4873774)
Well you can use a wrench for a hammer if you want, but that is exactly what ~/.ssh/config is for.

Can you please tell me the full patch?

Is
Code:

/home/user/.shh/config
??

descendant_command 01-20-2013 03:49 AM

yes

414N 01-20-2013 03:54 AM

"~" gets expanded by the shell to your current user's home path (also in $HOME environment variable).

miros84 01-20-2013 02:01 PM

I check that directory
Code:

/home/user/.shh/config
And I havenot got this file. I can create it and that's all?

colucix 01-20-2013 02:21 PM

Yes.
Code:

man ssh_config
explains it all.

colucix 01-20-2013 02:24 PM

Quote:

Originally Posted by unSpawn (Post 4873696)
This is probably easier:
Code:

echo -en "Host myremotehost"\nHostName 10.10.10.10\nPort 1000\n" >> ~/.ssh/config

There is an extra " here. It should read:
Code:

echo -en "Host myremotehost\nHostName 10.10.10.10\nPort 1000\n" >> ~/.ssh/config

unSpawn 01-20-2013 02:45 PM

WD, eagle eyes :-]

m1rr0rm3 01-21-2013 07:40 PM

SSH
 
Quote:

Originally Posted by descendant_command (Post 4873774)
Well you can use a wrench for a hammer if you want, but that is exactly what ~/.ssh/config is for.

ssh user@209.xxx.xxx.xxx

easiest way in yet

unSpawn 01-21-2013 07:43 PM

Quote:

Originally Posted by m1rr0rm3 (Post 4875019)
easiest way in yet

...but only if you don't read the OP's question properly, yes.


All times are GMT -5. The time now is 01:56 AM.