Operating System - Linux
1751791 Members
4896 Online
108781 Solutions
New Discussion юеВ

unable to scp but ssh works

 
monu_1
Regular Advisor

unable to scp but ssh works

Hi all,
I am able to ssh to ulogin on linux box(192.168.24.2) but not copy file under ulgoin home dir using scp from another machine?
here is ulogin account:-
#cat /etc/passwd | grep ulogin
ulogin:x:100:100:,,,:/tftpboot/chroot//./ulogin:/bin/sh
#cat /etc/group | grep ulogin
users:x:100:ulogin

now when i am going to scp this machine from another machine like below
scp ulogin@192.168.24.2:/abc.txt .
scp:/abc.txt:No such file or directory

Regards,
MKS
8 REPLIES 8
Steven E. Protter
Exalted Contributor

Re: unable to scp but ssh works

Shalom,

Your scp request is trying to write to the root directory.

You should and might have access restrictions there.

Try /tmp

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
monu_1
Regular Advisor

Re: unable to scp but ssh works

Thanks for reply. I got following error when remote copy from tmp folder-
scp ulogin@192.168.24.2:/tmp/file.txt .

Host '192.168.24.2' is not in the trusted hosts file.
(fingerprint md5 1c:60:7e:d9:3a:69:db:c7:64:e0:68:ff:eb:91:16:29)
Do you want to continue connecting? (y/n)
y
/bin/ssh: connection to ulogin@192.168.24.1:22 exited: No auth methods could be used.
Authorised users only. All activity may be monitored, logged and reported

What should I do to give for permission to copy?

Thx,
MKS
monu_1
Regular Advisor

Re: unable to scp but ssh works

Sorry!!!!below line was wrongly paste in above post
/bin/ssh: connection to ulogin@192.168.24.1:22 exited: No auth methods could be used.

correct line is as below
/bin/ssh: connection to ulogin@192.168.24.2:22 exited: No auth methods could be used.

Thanks,
MKS
Court Campbell
Honored Contributor

Re: unable to scp but ssh works

try adding, or changing, the line:

PasswordAuthentication yes

in the sshd_config on the remote server and restarting sshd.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Ivan Ferreira
Honored Contributor

Re: unable to scp but ssh works

It looks like scp is not understanding the chroot environment.

Try inverting the test, copy a file from the local host to the remote host in the default directory:

scp testfile ulogin@192.168.24.2:

Identify where testfile was uploaded. Then you will be able to identify the path you should specify for scp. Probably you should run:

scp ulogin@192.168.24.2:/tftpboot/chroot/ulogin/abc.txt .
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Court Campbell
Honored Contributor

Re: unable to scp but ssh works

Ah, I missed the chroot in the home directory. Are you sure you didn't miss any libraries, etc when you setup the chroot'ed ssh?
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Doug Garrick
Occasional Advisor

Re: unable to scp but ssh works

Are you displaying any messages in your .bash_profile? You may have to comment them out. scp will read the bash_profile and take the first text line (from the echo line) as an argument.

Re: unable to scp but ssh works

Try using the full path to the directory where the abc.txt file is located. That is, if the file is in your home directory (i.e: /home/ulogin ), try:

scp ulogin@192.168.24.2:/home/ulogin/abc.txt .

If chroot is not properly confiugured, it should work anyway.
Education is what survives when what has been learned has been forgotten