LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-09-2014, 03:56 PM   #1
socalheel
Member
 
Registered: Oct 2012
Location: Raleigh, NC
Distribution: CentOS / RHEL
Posts: 158

Rep: Reputation: 3
ssh-agent issue, cannot run as user but can as root


i'm cannot connect using ssh-agent from our web server to our repo server to pull site files.

i created the ssh keys using the user account (NOT root) and using
Code:
ssh-keygen
.

i can run my ssh-agent command as root and it works fine, but when i run as the user, i cannot.

any ideas why this is failing?

here is my command:

Code:
ssh-agent bash -c "ssh-add /home/username/.ssh/id_rsa;git clone gituser@git.workspace.com:clientname/reponame.git /home/username/sitefiles-temp"
here are the results:
as root:
Code:
Identity added: /home/username/.ssh/id_rsa (/home/username/.ssh/id_rsa)
Initialized empty Git repository in /home/username/sitefiles-temp/.git/
remote: Counting objects: 5887, done.
remote: Compressing objects: 100% (4184/4184), done.
remote: Total 5887 (delta 2061), reused 4850 (delta 1432)
Receiving objects: 100% (5887/5887), 18.14 MiB | 7.19 MiB/s, done.
limit = 0.1, actual = 7.011/2061)
perf stats for git-upload-pack on repo 'clientname/reponame.git':
  user CPU time: 4.89% (383/2061)
  sys  CPU time: 2.12
   elapsed time: 8.959208
Resolving deltas: 100% (2061/2061), done.
as user:
Code:
Identity added: /home/username/.ssh/id_rsa (/home/username/.ssh/id_rsa)
Initialized empty Git repository in /home/username/sitefiles-temp/.git/
gituser@git.workspace..com's password:
here are the directory permissions
Code:
[root@websrvr01 username]# ls -alh
total 40K
drwxr-xr-x    4 username users  4.0K Jul  9 16:41 .
drwxr-xr-x. 118 root          root   4.0K Jul  9 15:52 ..
-rw-------    1 username users  7.1K Jul  9 16:40 .bash_history
-rwxr-xr-x    1 username users    18 Feb 21  2013 .bash_logout
-rwxr-xr-x    1 username users   176 Feb 21  2013 .bash_profile
-rwxr-xr-x    1 username users   124 Feb 21  2013 .bashrc
-rwxr-xr-x    1 username users  2.0K Jul  9 16:31 deploy.sh
drwxrwxr-x    4 username apache 4.0K Jul  9 16:28 httpdocs
drwx------    2 username users  4.0K Jul  9 16:38 .ssh
You have mail in /var/spool/mail/root
[root@websrvr01 username ]# ls -lah .ssh
total 20K
drwx------ 2 username users 4.0K Jul  9 16:38 .
drwxr-xr-x 4 username users 4.0K Jul  9 16:41 ..
-rw------- 1 username users 1.7K Jul  9 16:38 id_rsa
-rw-r--r-- 1 username users  417 Jul  9 16:38 id_rsa.pub
-rw-r--r-- 1 username users  409 Jul  9 16:38 known_hosts
 
Old 07-09-2014, 06:59 PM   #2
socalheel
Member
 
Registered: Oct 2012
Location: Raleigh, NC
Distribution: CentOS / RHEL
Posts: 158

Original Poster
Rep: Reputation: 3
after so many freakin hours i figured this out.

this was a git problem not updating the authorized_key file on a commit. our commit wasn't successful, which causes git NOT to update the key file. once i resolved the commit problem, the authorized_key file was updated and voilia! success.

the reason root was successful was because it wasn't using the username id_rsa key pair ... defaulted to the root's key pair, even though i specified the username. i verified which key pair it was using by ssh -v -i <private key name>
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
more xfce 4.10 startup/shutdown scripts or run properly {gpg|ssh}-agent rpetrov Slackware - Installation 1 12-03-2012 02:16 AM
How to ssh as root to a workstation and then run commands as another user. martinhb Linux - Security 5 06-10-2009 10:04 PM
run a specific script with root privilege as any user(possibly with ssh) z940303 Programming 5 09-05-2007 08:20 PM
Someone calles ssh-agent as my user iiv Slackware 9 06-13-2007 01:45 PM
The_Sims for Linux doesnt run in regular User, but in Root. Slackware issue. RHLinuxGUY Linux - Games 4 11-02-2004 09:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration