//

Sunday, September 30, 2012

3 frequently asked questions about SSH

Open SSH
Hello Everyone,

Welcome to my first post in English (well, you can say its the second one). 

Today I'm gonna talk about three frequently asked questions i get on my job about SSH.

For those of you who dont familiar with the open ssh suite, I recommend you read about it here: http://www.openssh.org/


1. I get "connection refused" via ssh. How to solve this error?

first of all, check if the sshd daemon is running on the remote computer. You can do with following command:

service sshd status

you should get something like: "openssh-daemon is running"
If you getting something different you might found the problem. you can start the service like that:

service sshd start
I recommend you use ssh with the -v option which means "verbose". you will get more information about the command you trying.

try checking the status of ssh ports with:

netstat -tlp | grep ssh
if the iptables is on or any other kind of firewall, that could be anther reason for "connection refused".
you could also try to search the logs for something useful: /var/logs/messages 

2. How to use SSH for remotely executing commands?

Well, this answer is quite simply. for example the following will reboot the remote computer mario

ssh root@mario reboot
I use this kind of commands for checking logs on remote computer. It can be very useful.
Be aware that you might asked for password, which leads us for the next question:


2. How to use SSH without password?

when using ssh for remote actions (connect, command execution) the system will prompt you for password.
you can cancel the prompt and connect without password!.
Its very useful for sysadmins who works quite often on remote servers.

there are few simple steps for it to be done:

1. on the local computer:

ssh-keygen 
Press Enter key for each default option.
This is will create public and private key pair.

2. make sure on the remote computer there is a direcotory named .ssh in the user directory. if not create it

3. next copy the public key to the remote computer:

scp  ~/.ssh/id_rsa.pub  remote_linux:~/.ssh/
4. connect without password to the remote computer! =)

Thats it for this post.
Hope you will find this info helpful.

Happy Sukkot Holiday =)



1 comments:

atilla said...

edirne
hatay
ığdır
ısparta
muş

WEB2

Post a Comment