Topic "Can mkdir but not cp"

Author Message
jeffpoulsen
[View user's profile]

Joined: 2003-11-19
Posts: 6
Location: Georgia USA
I have been testing a chrooted user on RH9 and use WinSCP to do file transfers. I can log in fine, and restricted to the chroot. I can create folders fine. But I cannot copy a file from the host to the remote RH server. I have looked through the forum and found several things to check but hasn't fixed the problem. I have /bin/cp in the chrooted environment. I have ldd all the files and placed the output in the chroot. What could be missing? Thanks, jeff
_________________
Remember! Logic doesn't always work. Except it and move on.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
I'm missing any error messages in you post Smile Log file would be even better. Have you tried SFTP?
_________________
Martin Prikryl
jeffpoulsen
[View user's profile]

Joined: 2003-11-19
Posts: 6
Location: Georgia USA
I have tried to use sftp. Cannot login. I don't think I have it runnning on the server. I use scp all the time on other machines without problems. I guess this is limited to my chroot environment. I am unclear on how to put scp in the path. Does this mean in the /bin folder? That may help as it returns that error message. Well here is the log:

. --------------------------------------------------------------------------
. WinSCP Version 3.4.2 (Build 197)
. Login time: Thursday, November 20, 2003 6:15:31 AM
. --------------------------------------------------------------------------
. Session name: chjeff@10.10.202.35
. Host name: 10.10.202.35 (Port: 22)
. User name: chjeff (Password: Yes, Key file: No)
. Transfer Protocol: SCP
. SSH protocol version: 1; Compression: No
. Agent forwarding: No; TIS/CryptoCard: No; KI: Yes
. Ciphers: aes,blowfish,3des,WARN,des; Ssh2DES: No
. Ping interval: 0 sec (0 = off); Timeout: 15 sec
. SSH Bugs: -,-,-,-,-,-,-,-,
. Proxy: none
. Return code variable: Autodetect; Lookup user groups: No
. Shell: /bin/bash, EOL: 0
. Local directory: C:\My Documents, Remote directory: /home/chjeff/files, Update: No, Cache: Yes
. Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. Alias LS: No, Ign LS warn: Yes, Scp1 Comp: No
. --------------------------------------------------------------------------
. Looking up host "10.10.202.35"
. Connecting to 10.10.202.35 port 22
. Server version: SSH-1.99-OpenSSH_3.7.1p2
. We claim version: SSH-1.5-WinSCP-release-3.4.2.197
. Using SSH protocol version 1
. Received public keys
. Host key fingerprint is:
. 1024 38:4c:77:6d:78:d8:a1:dd:fe:a6:01:d5:d2:18:9f:94
. Encrypted session key
. AES not supported in SSH1, skipping
. Using Blowfish encryption
. Trying to enable encryption...
. Initialised Blowfish encryption
. Installing CRC compensation attack detector
. Successfully started encryption
. Sent username "chjeff"
. Session password prompt (chjeff@10.10.202.35's password: )
. Using stored password.
. Sending password with camouflage packets
. Sent password
. Authentication successful
. Started session
. --------------------------------------------------------------------------
. Using SCP protocol.
. Doing startup conversation with host.
. Skipping host startup message (if any).
> echo "WinSCP: this is end-of-file:0"
< WinSCP: this is end-of-file:0
. Detecting variable containing return code of last command.
. Trying "$status".
> echo "$status" ; echo "WinSCP: this is end-of-file:0"
< WinSCP: this is end-of-file:0
. Trying "$?".
> echo "$?" ; echo "WinSCP: this is end-of-file:0"
< 0
< WinSCP: this is end-of-file:0
. Return code variable "$?" selected.
. Clearing all aliases.
> unalias "echo" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 4: unalias: echo: not found
< WinSCP: this is end-of-file:1
> unalias "pwd" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 5: unalias: pwd: not found
< WinSCP: this is end-of-file:1
> unalias "cd" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 6: unalias: cd: not found
< WinSCP: this is end-of-file:1
> unalias "ls" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 7: unalias: ls: not found
< WinSCP: this is end-of-file:1
> unalias "groups" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 8: unalias: groups: not found
< WinSCP: this is end-of-file:1
> unalias "scp" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 9: unalias: scp: not found
< WinSCP: this is end-of-file:1
> unalias "rm" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 10: unalias: rm: not found
< WinSCP: this is end-of-file:1
> unalias "mv" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 11: unalias: mv: not found
< WinSCP: this is end-of-file:1
> unalias "mkdir" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 12: unalias: mkdir: not found
< WinSCP: this is end-of-file:1
> unalias "chmod" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 13: unalias: chmod: not found
< WinSCP: this is end-of-file:1
> unalias "chgrp" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 14: unalias: chgrp: not found
< WinSCP: this is end-of-file:1
> unalias "chown" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 15: unalias: chown: not found
< WinSCP: this is end-of-file:1
> unalias "unset" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 16: unalias: unset: not found
< WinSCP: this is end-of-file:1
> unalias "unalias" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 17: unalias: unalias: not found
< WinSCP: this is end-of-file:1
> unalias "alias" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 18: unalias: alias: not found
< WinSCP: this is end-of-file:1
> unalias "ln" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 19: unalias: ln: not found
< WinSCP: this is end-of-file:1
> unalias "%s" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 20: unalias: %s: not found
< WinSCP: this is end-of-file:1
. Clearing national user variables.
> unset "LANG" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
> unset "LANGUAGE" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
> unset "LC_CTYPE" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
> unset "LC_COLLATE" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
> unset "LC_MONETARY" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
> unset "LC_NUMERIC" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
> unset "LC_TIME" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
> unset "LC_MESSAGES" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
> unset "LC_ALL" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
> unset "HUMAN_BLOCKS" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
. Changing directory to "/home/chjeff/files".
> cd "/home/chjeff/files" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
. Getting current directory name.
> pwd ; echo "WinSCP: this is end-of-file:$?"
< /home/chjeff/files
< WinSCP: this is end-of-file:0
. Listing current directory.
> ls -la ; echo "WinSCP: this is end-of-file:$?"
< total 12
< drwxrwx--- 3 500 500 4096 Nov 19 20:30 .
< drwxrwx--- 3 500 500 4096 Nov 19 21:19 ..
< drwxr-xr-x 2 500 500 4096 Nov 19 20:30 New folder
< WinSCP: this is end-of-file:0
. Startup conversation with host finished.
. Changing directory to "New folder".
> cd "New folder" ; echo "WinSCP: this is end-of-file:$?"
< WinSCP: this is end-of-file:0
. Getting current directory name.
> pwd ; echo "WinSCP: this is end-of-file:$?"
< /home/chjeff/files/New folder
< WinSCP: this is end-of-file:0
. Listing current directory.
> ls -la ; echo "WinSCP: this is end-of-file:$?"
< total 8
< drwxr-xr-x 2 500 500 4096 Nov 19 20:30 .
< drwxrwx--- 3 500 500 4096 Nov 19 20:30 ..
< WinSCP: this is end-of-file:0
. Copying 1 files/directories to remote directory "/home/chjeff/files/New folder/"
. PrTime: Yes; PrRO: Yes; Rght: rw-r--r--; PrR: No; FnCs: N; RIC: Yes; Resume: S (10240); CalcS: Yes
. TM: M; AscM: *.*htm*; *.txt; *.php*; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
> echo "WinSCP: this is begin-of-file" ; scp -r -d -t "/home/chjeff/files/New folder" ; echo "WinSCP: this is end-of-file:$?"
! /bin/bash: line 37: scp: command not found
< WinSCP: this is begin-of-file
< inSCP: this is end-of-file:127
. Directory content loaded from cache.
* (ECommand) Copying files to remote side failed.
* Cannot execute SCP to start transfer. Please make sure that SCP is installed on the server and path to it is included in PATH. You may also try SFTP instead of SCP.
* Command failed with return code 127.
. Closing connection.


Thanks for any help. jeff
_________________
Remember! Logic doesn't always work. Except it and move on.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
SCP must be in any of the paths contained in PATH environment variable. /bin would probably help.
_________________
Martin Prikryl
jeffpoulsen
[View user's profile]

Joined: 2003-11-19
Posts: 6
Location: Georgia USA
I have tried everything I can think of. I have copied all the libraries needed. I have searched the web to find clues. Even new OS with ./config --with-pam or --with-default-path-etc,etc,etc and without any options. I have edited the .bash_profile to include the path to scp. /bin/scp or /usr/bin/scp or /usr/local/bin/scp. I have tried putting scp in the chrooted /bin folder and the /bin folder. I still get the error message "Cannot execute SCP to start transfer. Please make sure that SCP is installed on the server and path to it is included in PATH" It seems that even root is not able to transfer files after installing and configuring the chroot. I used the following link to help with the setup. My machine had a few different folders and files, but I copied all that ldd showed for each command.Here is the url. https://www.netadmintools.com/art294.html What would you suggest I look into as the cause of this problem? Perhaps it is with the chootpatched download? Thank you for your time and consideration. jeffpoulsen
_________________
Remember! Logic doesn't always work. Except it and move on.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Try two things: Set PATH in .bashrc instead of .bash_profile as on some servers .bash_profile is not executed for non-interactive sessions (WinSCP case). If it does not help, try to copy SCP to user's home directory, just to verify that it is at least possible to run it.
_________________
Martin Prikryl
jeffpoulsen
[View user's profile]

Joined: 2003-11-19
Posts: 6
Location: Georgia USA
I have before tried to put scp in the home directory and just now again with no luck. I also modified the .bashrc file. I think this is correct:

# .bashrc

# User specific aliases and funtions

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
PATH=$PATH:$HOME/bin:/bin/scp

Question though? Am I to have a /etc/scp in the chroot? Well I have come to belive that the problem is not with WinSCP. It works great on all other servers. I think it is with the chroot patched version of oppenssh. If you can let me know if you think I should mkdir /etc in the chroot. After that I may try to source another chroot sourcecode. Thanks for so much support. jeffpoulsen
_________________
Remember! Logic doesn't always work. Except it and move on.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
I'm sorry, but I do not have any clue for you Sad
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License