Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I need to set up password less ssh between two machines for a non root user(say foo) in order to write some scripts for automating some mundane tasks. To ...
  1. #1
    Just Joined! amit4g's Avatar
    Join Date
    Feb 2007
    Location
    Bangalore,India
    Posts
    63

    Password less ssh for non root user

    Hi,

    I need to set up password less ssh between two machines
    for a non root user(say foo) in order to write some
    scripts for automating some mundane tasks.
    To do this i tried following, but is not working

    <Machine 1>
    [root@peer1] useradd foo
    [root@peer1] su foo
    [foo@peer1] mkdir -p /home/foo/.ssh
    [foo@peer1] chmod 700 /home/foo/.ssh
    [foo@peer1] ssh-keygen -t rsa -b 1024 -N '' -P '' -f <--- for non interactive empty passphrase
    [foo@peer1] exit
    [root@peer1] scp /home/foo/.ssh/id_rsa.pub root@peer2:/tmp/
    password less ssh is already enabled for root user on peer2.
    <Machine 1>

    <Machine 2>
    [root@peer2] useradd foo
    [root@peer2] mkdir -p /home/foo/.ssh
    [root@peer2] cat /tmp/id_rsa.pub >>/home/foo/.ssh/authorized_keys
    [root@peer2] chown -R foo /home/foo/.ssh
    [root@peer2] chgrp -R foo /home/foo/.ssh
    <Machine 2>

    Please let me know, what am i missing here.
    I've root privileges on both these two machines(peer1 and peer2)
    and the user 'foo' doesn't exist until i add him.

    Thanks,
    amit

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    On machine 2:

    1) Make sure permissions on /home/foo/.ssh is 700
    2) Make sure /home/foo/.ssh/authorized_keys is owned by foo and permissions is 600

  3. #3
    Just Joined! amit4g's Avatar
    Join Date
    Feb 2007
    Location
    Bangalore,India
    Posts
    63
    Thanks lomcevak !
    After changing the permissions as you've mentioned, it worked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...