Passwordless root authentication via SSH


 
Thread Tools Search this Thread
Operating Systems AIX Passwordless root authentication via SSH
# 1  
Old 10-30-2007
Question Passwordless root authentication via SSH

Hello,

I would like to issue a couple of commands as root on a remote machine without having to enter the root password. I used "ssh-keygen -t rsa" to generate the encryption keys, copied the public key to the remote machine, etc.

I also tried playing around with the sshd_config file and restarting the sshd daemon on the remote machine. I tried setting PermitRootLogin to yes, without-password, and forced-commands-only. None of these worked. I get a permission denied error when I try:
ssh root@[machine] -o PreferredAuthentications=publickey -vv

I was successful in setting up public key authentication to the same remote machine using a login other than root. However, I have to run the remote commands as root, so this does not do me too much good.

Advice would be much appreciated.

Thanks!
# 2  
Old 11-06-2007
It just sounds like you may have a key problem

Step 1
install stup ssh and make sure it is running you can use putty or telnet to test
telnet to port 22 on remote system



Step 2
generate a key on local system ( as user required )
ssh-keygen -t rsa

Follow the on-screen instructions, but don't set a password when prompted, as you will then need to enter the password each time you want to use the key. This creates a private and a public key file.

Step 3
Now you just need to append the contents of the public key file in .ssh/id_rsa.pub, and append it to the .ssh/authorized_keys file on the remote host and user you want to use when logging in. You need to append the public key file contents to each machine you want to log in to automatically.


Note
if you want to go back to the other system make sure you create a key on each system and then just need to append the contents of the public key file in .ssh/id_rsa.pub, and append it to the .ssh/authorized_keys file


OpenSSH is now bundled with AIX
# 3  
Old 11-20-2007
and to make it a bit easier...

So you generated your public key on the local system using ssh-keygen...now you need to copy it to the remote system and append right?


1. cd into /root/.ssh on your source box
2. Use this command:

cat *.pub | ssh <hostname> "cat - >> /root/.ssh/authorized_keys"

You will read out the the contents of your rsa/dsa .pub keys, using ssh to copy and append to the destination host. After you type the password (for the last time), then try again something simple such as:

ssh <hostname> date

And if you've done everything correctly, no password.
# 4  
Old 11-20-2007
depending on the commands you are trying to run.... sudo may be a better option.

in the target machine do visudo and add your user name (or at least the username you have the ssh keys working)

there are examples in the suders file of how to set. But this is the basic idea.

username ALL=(ALL) NOPASSWD: ALL

Just a thought.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ssh passwordless authentication

Hey team I have to enable password less authentication betweeen A to B server and A to C server and A to D server. For this I generated a ssh key on server A using ssh-keygen command and copied the key using ssh-copy-id command to B, C and D server. Everything is working fine as of now but... (5 Replies)
Discussion started by: Sandeep_sandy
5 Replies

2. Shell Programming and Scripting

Passwordless Authentication and Anonymous login

Hi, I am in the process FTPing some of my report files from my production server to another FTP server through batch/Shell Script. This is working fine with the password less authentication. Once i place all my report files in the ftp server the end users need to download ... (3 Replies)
Discussion started by: Showdown
3 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Passwordless authentication lost between cluster nodes

after copying the public key then also the passwordless authentication is not working Best regards, Vishal (2 Replies)
Discussion started by: Vishal_dba
2 Replies

4. Solaris

Passwordless ssh for root

Hi Experts, I am trying to setup passwordless ssh for root between two of my solaris servers(say A & B). I have exchanged the public keys between both servers. Password less ssh working fine while I try to connect from Server A to Server B. However it is still asking password... (6 Replies)
Discussion started by: sai_2507
6 Replies

5. Ubuntu

Passwordless ssh authentication fails

Unable to set ssh passwordless authentication I am unable to ssh with passwordless authentication from Windows client onto UBuntu server. The ssh version on UBuntu is OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e , while SSH on Windows Client is OpenSSH_5.1p1, OpenSSL 0.9.8k. I turned on ssh... (5 Replies)
Discussion started by: tkota
5 Replies

6. Red Hat

ssh private key passwordless authentication

Hello, Need a suggestion to setup private key passwordless authentication. I am not sure this can done or not :wall: here is the sincerio I have two servers, sever1 with a user "user1" and servera with usera here dataflow: usera from servera, will pull/push files to server1 on user1... (2 Replies)
Discussion started by: bobby320
2 Replies

7. AIX

passwordless ssh for non-root user???

hi all I have a problem to set up the password ssh login for a non-root user. what I want to do is that non-root user in host A logs into host B without password prompted. what I did listed as the following steps. 1. genarate a pair of keys from host A. ssy-keygen -t rsa -N "" -f... (9 Replies)
Discussion started by: rs6000er
9 Replies

8. Shell Programming and Scripting

Setup multiple passwordless authentication

I have experience in setting up passwordless authentication by sharing ssh public keys manually.Currently I am in the process to the write a script to perform the same functionality from one source(host) to multiple destinations. I have one source host (Host A) whose public keys has to be shared... (9 Replies)
Discussion started by: Lancel0t
9 Replies

9. Shell Programming and Scripting

passwordless authentication of SFTP script

Dear All I need to discuss about the problem which has been discussed so many times here. I need to transfer a file from server A to server B via passwordless SFTP script. By reading the threads on this topic here, I followed the below steps but still it's not working .. Pls find the steps... (13 Replies)
Discussion started by: uday.shankar
13 Replies

10. AIX

Passwordless authentication via SSH

I am trying to implement passwordless authentication via ssh2. I have used the well documented technique of generating a key pair with a blank passphrase on my client machine, and installing the public key on the destination server (AIX 5.3) in the user's .ssh2 directory. I have used this technique... (1 Reply)
Discussion started by: RegX
1 Replies
Login or Register to Ask a Question