LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   SSH and autologin? (http://www.linuxquestions.org/questions/linux-general-1/ssh-and-autologin-49361/)

presstone 03-11-2003 10:19 PM

SSH and autologin?
 
Here's my situation. My server is Redhat 8. I use Mac OS X via the terminal to connect using ssh to the server. Now, is there anyway to have it just login and not as for a password when I use:

ssh -l default 192.168.1.3

? It always comes back asking for a password. I would like a way around that and have it so that i just gives me the command prompt of the redhat server and never ask for a password. I did read about using public and private keys but got lost :confused:. Can anyone help me here?

crichards 03-11-2003 10:34 PM

Thats a good thing. You don't want to disable a password, especially for ssh and other remote connection software, since thats a major security problem.

presstone 03-11-2003 10:57 PM

Quote:

Originally posted by crichards
Thats a good thing. You don't want to disable a password, especially for ssh and other remote connection software, since thats a major security problem.
I'd rather take the risk. I am trying to make a program that will get into my redhat server and display the log from a running process (using screen). I really need to get rid of the password question, at least on my side. I don't want to take it off the server but if i can do it that way, tell me how. I don't care if someone breaks into it because it's by itself on it's own network and if they trash the server i can just rebuild it, no biggie.

Burke 03-12-2003 08:51 AM

Overall, you'd probably be better off just writing a php script that parses the log you're trying to check on.

gmasci 03-12-2003 09:20 AM

You can use ssh-keygen to generate public and private keys. The public key you will want to paste to the know_hosts file in your ~/.ssh/ directory on the server. Also look into .shost file

presstone 03-12-2003 02:33 PM

Quote:

Originally posted by Burke
Overall, you'd probably be better off just writing a php script that parses the log you're trying to check on.
Nah, I want to do much more than just check log. My plan was to make a program for viewing the log and displaying (every minute or so) the response to the status command for the server. I have a counter-strike server running and I want to make a program for Mac OS X that displays the status of the server constantly. There's gotta be another way...

m0rl0ck 03-12-2003 09:02 PM

1. run ssh-agent to start a shell for ssh-keygen
2.run ssh-keygen to generate the needed keys
3. copy the users public key to the authorized_keys file of the remote machine
(authorized_keys2 if using ssh protocol 2)

Thats it. Your user should be able to log into the remote machine without passwords. You can also run programs on the remote machine just by doing:

ssh machine.mynet.com programname


Key authentication is pretty safe as long as the actual keys are safe. No passwords flying around the net for one thing, nothing to sniff :)

any questions?

If your reading a specific howto and getting lost, where is it and where are you getting lost?

presstone 03-12-2003 09:15 PM

Quote:

Originally posted by m0rl0ck
1. run ssh-agent to start a shell for ssh-keygen
2.run ssh-keygen to generate the needed keys
3. copy the users public key to the authorized_keys file of the remote machine
(authorized_keys2 if using ssh protocol 2)

I did make the keys... rsa1, rsa and a dsa key. I did read somewhere that I need to copy that key to the other machine but it told me to put it in ~/.ssh but that doesn't exist. Where should I put it (RedHat 8) and what should it be called?

Quote:

Thats it. Your user should be able to log into the remote machine without passwords. You can also run programs on the remote machine just by doing:

ssh machine.mynet.com programname

I actually log in using ssh, run screen and run the program from screen. If the server is running, I use screen -r to see the server. I love that screen program :-)

Thanks for your help. This is exactly what I was looking for :-)

m0rl0ck 03-12-2003 09:40 PM

Quote:

told me to put it in ~/.ssh but that doesn't exist. Where should I put it (RedHat 8) and what should it be called

The user has to be the same on both machines. Lets say the user is gbush.

The public key generated would go into the /home/gbush/.ssh/authorized_keys file on the remote machine.
Now gbush can log into the remote machine without a password.

Be careful copying the keys to the remote machine if you get a line break in them they wont work.


All times are GMT -5. The time now is 11:06 AM.