1834078 Members
2885 Online
110063 Solutions
New Discussion

Re: Change user

 
nash11
Frequent Advisor

Change user

I would like to use "scp" to copy file from host A to host B , how to change the user of host A before file copy .

example :
Host A has a user peter & george
Host B has a user tom

at Host A run "scp file host B" , the copy process will run by peter , if I want the file copy is run by george , what can I do ? thx
8 REPLIES 8
Steven E. Protter
Exalted Contributor

Re: Change user

Shalom


logged on as peter
scp -p filename tom@hostname:/tmp

Thats the basic syntax. So long as you know the passwords you can but username@ in front of the hostname.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
nash11
Frequent Advisor

Re: Change user

thx steven,

I have one more questions , If I want to allow null password to copy file , what can I do ? thx
Yarek
Regular Advisor

Re: Change user

You should use the user account registered on host B

scp file tom@hostB:/destination_directory

and then You will be asked to enter tom's password

Good luck!
nash11
Frequent Advisor

Re: Change user

thx Yarek,

it works now , If I want to allow tom can use null password to copy file , what can I do ? thx
Yarek
Regular Advisor

Re: Change user

Nash,

I've never used null password in my environment. I think it is not good idea
Rather than i recommend You to generate "ssh key" (ssh-keygen with -N '' arguments which tells it to generate keys with null passwords)




rgds
nash11
Frequent Advisor

Re: Change user

thx reply,

I never try to generate key , can advise how to generate key ? thx
Peter Nikitka
Honored Contributor

Re: Change user

Hi,

look at the man page of ssh - you'll find all you need to setup passwordless file transfer.

In short:
- create keys for the 'from-user'
- put the public key of the 'from-user' into the authorized_keys file of the 'to-user'.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Yarek
Regular Advisor

Re: Change user

Nash,

please check:

http://docs.hp.com/en/T1471-90015/T1471-90015.pdf

I think it can be helpful.