Passwordless sftp using a different user than the runtime user


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Passwordless sftp using a different user than the runtime user
# 1  
Old 05-25-2016
Passwordless sftp using a different user than the runtime user

I am running a shell script as user A. In that script I need to execute a sftp that would transfer the file using another user B.
I am using the below command:
Code:
sftp -oPort22 B@remote server

However, I am getting password prompts each time.
I have done the following:
  1. Added the public contents from local server to remoter servers /home/<user>/.ssh/authorized_keys.
  2. Tried changing permission of .ssh directory to both 700 and 744. Also, tried changing permission of authorized_keys to both 600 and 644.
Nothing has worked so far.

I guess, the command I am passing is correct as sftp is happening; but the passwordless authorization not working may be due to some file permissions issues.
Need your inputs
# 2  
Old 05-25-2016
What user's authorized_keys did you add the key to? Needs to be user B's!
# 3  
Old 05-25-2016
So, I have added content of public key or authorized_keys of user B to user A's. I am not sure what file permission should be for both
# 4  
Old 05-25-2016
The public key created by user A (and matching his or her private key) needs to be in user B's remote authorized_keys file.
# 5  
Old 05-25-2016
Thanks a lot RuDic...it worked...SmilieSmilieSmilieSmilieSmilieSmilieSmilieSmilieSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Passwordless ssh for different user

Hello Folks, I lost touch in ssh key gen topics. I am in need of ssh to a server without password, kindly help me in configuring. I have two servers, server1 with user name apha & server1 with user name beta. I need to ssh to the server2 from server1 with respective users, Manually i... (3 Replies)
Discussion started by: Thala
3 Replies

2. Red Hat

Runtime Error Enable user directory apache

Hi I am exactly according to this link CentOS 6 - Apache httpd - Enable Userdir : Server World I Enabled userDirectory Server version: Apache/2.2.15 CentOS release 6.8 (Final) But Iget this Error Forbidden You don't have permission to access /~mn/index.html on this server Goal... (2 Replies)
Discussion started by: mnnn
2 Replies

3. Shell Programming and Scripting

Check whether user has passwordless setup

Hello Unix scripters, I have created a small tool that i can distribute to users to check whether they have passwordless login to a list of servers. The problem in my code below is if user do not have the passwordless login yet, it will prompt them with a password login and my message below... (2 Replies)
Discussion started by: ryandegreat25
2 Replies

4. AIX

passwordless entry using ssh from one user to a different user on the same server

Hi, We have a requirement to do passwordless entry from one user to a different user on the same AIX server using ssh keys. Can some one help me with this? Thanks in advance, Panditt (3 Replies)
Discussion started by: deshaipet
3 Replies

5. Shell Programming and Scripting

su -m <user> passwordless?

Hi! I am working on mac osx and have a script which prompts for password for a non-root user, can I avoid that? su -m <user> Prompts for a password. Its a startup script and the start up fails? How can I fix this? Thanks, Jack. (4 Replies)
Discussion started by: jacki
4 Replies

6. 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

7. UNIX for Advanced & Expert Users

Determining if user is local-user in /etc/passwd or LDAP user

Besides doing some shell-script which loops through /etc/passwd, I was wondering if there was some command that would tell me, like an enhanced version of getent. The Operating system is Solaris 10 (recent-ish revision) using Sun DS for LDAP. (5 Replies)
Discussion started by: ckmehta
5 Replies

8. UNIX for Dummies Questions & Answers

FTP or SFTP User

Hello there, is there any command in Unix to check that following ftp user is ftp or sftp user. Thanks. (1 Reply)
Discussion started by: ahhmedbilal
1 Replies

9. Shell Programming and Scripting

To Change the user during runtime

Hi, I have a requirement to change the user during runtime within a shell script. Is their any way via which I can change the user by prefeeding the password? Please reply. Thanks. (4 Replies)
Discussion started by: sam_roy
4 Replies

10. UNIX for Dummies Questions & Answers

How to link to some lib in runtime as a nonsuper user?

My program is written in cpp and it uses a non standard library. I have compiled successfully by linking it to the library. But when i try to run the program. it give a error message like: "error while loading shared libraries: ***.so: cannot open shared object file: No such file or directory"... (2 Replies)
Discussion started by: zzz_zzz
2 Replies
Login or Register to Ask a Question