08.04.2013 11:13 полÑзоваÑÐµÐ»Ñ "Didier Wiroth" <dwir...@gmail.com> напиÑал: > > Hello, > (running current with OpenSSH_6.2, OpenSSL 1.0.1c 10 May 2012) > > I'm trying to setup chrootdirectory in sshd_config as a test configuration > without success. > > Here is a snip from my sshd_config > ---- > #(this is the default line) > Subsystem sftp /usr/libexec/sftp-server > > #added the following match block > Match Group remote-sync, Address 127.0.0.1 > ChrootDirectory /home/chroot/%u > ForceCommand internal-sftp -f LOCAL0 -l INFO > AllowAgentForwarding no > AllowTcpForwarding no > GatewayPorts no > X11Forwarding no > --- > > The home directory /home/chroot/sync is owned by root:wheel. > > When I try to connect I get the following error: > cannot stat /usr/libexec/sftp-server: No such file or directory > > What do I miss? > What is wrong with my test config?
It's obvious that global configuration parameter is involved. That means that your Match rule doesn't work. > Thanks for any input!!! > Didier > > See the entire output here: > $ sudo /usr/sbin/sshd -D -d -p 2222 -f /etc/ssh/sshd_config > debug1: sshd version OpenSSH_6.2, OpenSSL 1.0.1c 10 May 2012 > debug1: read PEM private key done: type RSA > debug1: private host key: #0 type 1 RSA > debug1: read PEM private key done: type DSA > debug1: private host key: #1 type 2 DSA > debug1: read PEM private key done: type ECDSA > debug1: private host key: #2 type 3 ECDSA > debug1: rexec_argv[0]='/usr/sbin/sshd' > debug1: rexec_argv[1]='-D' > debug1: rexec_argv[2]='-d' > debug1: rexec_argv[3]='-p' > debug1: rexec_argv[4]='2222' > debug1: rexec_argv[5]='-f' > debug1: rexec_argv[6]='/etc/ssh/sshd_ > config' > debug1: Bind to port 2222 on 0.0.0.0. > Server listening on 0.0.0.0 port 2222. > debug1: Bind to port 2222 on ::. > Server listening on :: port 2222. > debug1: fd 5 clearing O_NONBLOCK > debug1: Server will not fork when running in debugging mode. > debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8 > debug1: inetd sockets after dupping: 3, 3 > Connection from 127.0.0.1 port 31875 > debug1: Client protocol version 2.0; client software version OpenSSH_6.2 > debug1: match: OpenSSH_6.2 pat OpenSSH* > debug1: Enabling compatibility mode for protocol 2.0 > debug1: Local version string SSH-2.0-OpenSSH_6.2 > debug1: permanently_set_uid: 27/27 [preauth] > debug1: list_hostkey_types: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256 [preauth] > debug1: SSH2_MSG_KEXINIT sent [preauth] > debug1: SSH2_MSG_KEXINIT received [preauth] > debug1: kex: client->server aes128-ctr hmac-md5-...@openssh.com > z...@openssh.com [preauth] > debug1: kex: server->client aes128-ctr hmac-md5-...@openssh.com > z...@openssh.com [preauth] > debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth] > debug1: SSH2_MSG_NEWKEYS sent [preauth] > debug1: expecting SSH2_MSG_NEWKEYS [preauth] > debug1: SSH2_MSG_NEWKEYS received [preauth] > debug1: KEX done [preauth] > debug1: userauth-request for user sync service ssh-connection method none > [preauth] > debug1: attempt 0 failures 0 [preauth] > debug1: user sync matched group list remote-sync, at line 124 > debug1: connection from 127.0.0.1 matched 'Address 127.0.0.1' at line 124 > debug1: userauth_banner: sent [preauth] > debug1: userauth-request for user sync service ssh-connection method > publickey [preauth] > debug1: attempt 1 failures 0 [preauth] > debug1: test whether pkalg/pkblob are acceptable [preauth] > debug1: temporarily_use_uid: 1001/999 (e=0/0) > debug1: trying public key file /home/chroot/sync/.ssh/authorized_keys > debug1: fd 4 clearing O_NONBLOCK > debug1: matching key found: file /home/chroot/sync/.ssh/authorized_keys, > line 3 > Found matching RSA key: c9:1b:a7:00:9c:52:08:44:1b:2f:7e:28:94:f4:e0:af > debug1: restore_uid: 0/0 > Postponed publickey for sync from 127.0.0.1 port 31875 ssh2 [preauth] > debug1: userauth-request for user sync service ssh-connection method > publickey [preauth] > debug1: attempt 2 failures 0 [preauth] > debug1: temporarily_use_uid: 1001/999 (e=0/0) > debug1: trying public key file /home/chroot/sync/.ssh/authorized_keys > debug1: fd 4 clearing O_NONBLOCK > debug1: matching key found: file /home/chroot/sync/.ssh/authorized_keys, > line 3 > Found matching RSA key: c9:1b:a7:00:9c:52:08:44:1b:2f:7e:28:94:f4:e0:af > debug1: restore_uid: 0/0 > debug1: ssh_rsa_verify: signature correct > Accepted publickey for sync from 127.0.0.1 port 31875 ssh2 > debug1: monitor_child_preauth: sync has been authenticated by privileged > process > debug1: Enabling compression at level 6. [preauth] > debug1: monitor_read_log: child log fd closed > User child is on pid 2371 > Changed root directory to "/home/chroot/sync" > debug1: Entering interactive session for SSH2. > debug1: server_init_dispatch_20 > debug1: server_input_channel_open: ctype session rchan 1 win 2097152 max > 32768 > debug1: input_session_request > debug1: channel 0: new [server-session] > debug1: session_new: session 0 > debug1: session_open: channel 0 > debug1: session_open: session 0: link with channel 0 > debug1: server_input_channel_open: confirm session > debug1: server_input_channel_req: channel 0 request subsystem reply 1 > debug1: session_by_channel: session 0 channel 0 > debug1: session_input_channel_req: session 0 req subsystem > subsystem request for sftp by user sync > debug1: subsystem: cannot stat /usr/libexec/sftp-server: No such file or > directory > debug1: subsystem: exec() /usr/libexec/sftp-server > debug1: Forced command (config) 'internal-sftp -f LOCAL0 -l INFO ' > debug1: Received SIGCHLD. > debug1: session_by_pid: pid 31726 > debug1: session_exit_message: session 0 channel 0 pid 31726 > debug1: session_exit_message: release channel 0 > debug1: session_by_channel: session 0 channel 0 > debug1: session_close_by_channel: channel 0 child 0 > debug1: session_close: session 0 pid 0 > debug1: channel 0: free: server-session, nchannels 1 > Received disconnect from 127.0.0.1: 11: disconnected by user > debug1: do_cleanup > debug1: do_cleanup