#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    2
    Rep Power
    0

    Ssh password less login with different ID


    I have setup password less ssh connection between Server A and Server B for 2 users U1 and U2 and I am able to connect and execute some commands.

    But my requirement is, Login into Server1 as U1 and ssh U2@ServerB, but it is asking password.

    Also I copied the public keys between U1, U2 to Server A & B and still it is asking passowrd for cross ssh.

    that is I copied ServerA:U1 id_rsa.pub key and added in ServerB:U2 authorizedLkey file.
    and
    ServerA:U2 id_rsa.pub and added in ServerB:U1 auth key file.



    Server A:
    Login as User 1 and execute sh script, it has
    /usr/bin/ssh -t user2@ServerB -- Asking password here

    Server 2:
    user 2 has permission to execute ServerB script

    Please help me to solve this issue.
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    840
    Rep Power
    387
    Originally Posted by sakthi.99it
    I have setup password less ssh connection between Server A and Server B for 2 users U1 and U2 and . . .
    . . . E t c . . .
    Server A:
    Login as User 1 and execute sh script, it has
    /usr/bin/ssh -t user2@ServerB -- Asking password here

    Server 2:
    user 2 has permission to execute ServerB script

    Please help me to solve this issue.
    If U1 and U2 are different user id's, then you have not established password-less connectivity.

    As I understand it, password-less connectivity is between Server A/U1 and Server B/U1 (same user id).

    You may need to connect to server B using U1 and then su to U2.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    2
    Rep Power
    0
    I have a shell script running in Server A and U1 has access to it. and in Server B shell script has access to U2.

    so I need to login in Server A as U1 and execute sh script which has ssh to ServerB:U2 and execute it.

    I hope it is possible, If is not not possible please suggest me work around.
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    You could use Expect and script the whole thing out (assuming you don't mind putting U2's password in the script).
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  8. #5
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    840
    Rep Power
    387

    Cool


    Originally Posted by sakthi.99it
    I have a shell script running in Server A and U1 has access to it. and in Server B shell script has access to U2.

    so I need to login in Server A as U1 and execute sh script which has ssh to ServerB:U2 and execute it.

    I hope it is possible, If is not not possible please suggest me work around.
    Work around is:
    Originally Posted by LKBrwn_DBA
    REPEAT:
    You may need to connect to server B using U1 and then su to U2.

IMN logo majestic logo threadwatch logo seochat tools logo