Rssh sftp centos 6.3

 

Rssh sftp centos6.3
 
[root@aa-mysql-02 usr]# yum install rssh-2.3.3-2.el6.x86_64.rpm
 
 
[root@aa-mysql-02 scusftp]# vi /etc/rssh.conf
 
[root@aa-mysql-02 scusftp]# cat /etc/rssh.conf
# This is the default rssh config file
 
# set the log facility. "LOG_USER" and "user" are equivalent.
logfacility = LOG_USER
 
# Leave these all commented out to make the default action for rssh to lock
# users out completely...
 
allowscp
allowsftp
#allowcvs
#allowrdist
#allowrsync
 
# set the default umask
umask = 022
 
# If you want to chroot users, use this to set the directory where the root of
# the chroot jail will be located.
#
# if you DO NOT want to chroot users, LEAVE THIS COMMENTED OUT.
chrootpath = /usr/local/chroot
 
# You can quote anywhere, but quotes not required unless the path contains a
# space... as in this example.
#chrootpath = "/usr/local/my chroot"
 
##########################################
# EXAMPLES of configuring per-user options
 
#user=rudy:077:00010: # the path can simply be left out to not chroot
#user=rudy:077:00010    # the ending colon is optional
 
#user=rudy:011:00100: # cvs, with no chroot
#user=rudy:011:01000: # rdist, with no chroot
#user=rudy:011:10000: # rsync, with no chroot
#user="rudy:011:00001:/usr/local/chroot" # whole user string can be quoted
#user=rudy:01"1:00001:/usr/local/chroot" # or somewhere in the middle, freak!
#user=rudy:'011:00001:/usr/local/chroot' # single quotes too
 
# if your chroot_path contains spaces, it must be quoted...
# In the following examples, the chroot_path is "/usr/local/my chroot"
#user=rudy:011:00001:"/usr/local/my chroot" # scp with chroot
#user=rudy:011:00010:"/usr/local/my chroot" # sftp with chroot
#user=rudy:011:00011:"/usr/local/my chroot" # both with chroot
 
# Spaces before or after the '=' are fine, but spaces in chrootpath need
# quotes.
#user = "rudy:011:00001:/usr/local/my chroot"
#user = "rudy:011:00001:/usr/local/my chroot" # neither do comments at line end
#user=077:00010:"/tmp/mcd"
[root@aa-mysql-02 scusftp]#
 
 
setup chroot
 /usr/chroot
 
 
mkdir -p /usr/chroot/usr/bin
cp -p /usr/bin/scp /usr/chroot/usr/bin/
mkdir -p /usr/chroot/usr/libexec/openssh
cp -p /usr/libexec/openssh/sftp-server /usr/chroot/usr/libexec/openssh/
mkdir -p /usr/chroot/usr/local/libexec
cp -p /usr/local/libexec/rssh_chroot_helper /usr/chroot/usr/local/libexec/rssh_chroot_helper
mkdir -p /usr/chroot/lib
cp -p /lib/ld-linux.so.2 /usr/chroot/lib/
cp -p /lib/libresolv.so.2 /usr/chroot/lib/
cp -p /lib/libcrypto.so.6 /usr/chroot/lib/
cp -p /lib/libutil.so.1 /usr/chroot/lib/
cp -p /lib/libnsl.so.1 /usr/chroot/lib/
cp -p /lib/libcrypt.so.1 /usr/chroot/lib/
cp -p /lib/libcom_err.so.2 /usr/chroot/lib/
cp -p /lib/libdl.so.2 /usr/chroot/lib/
cp -p /lib/libc.so.6 /usr/chroot/lib/
cp -p /lib/libkeyutils.so.1 /usr/chroot/lib/
cp -p /lib/libpthread.so.0 /usr/chroot/lib/
cp -p /lib/libselinux.so.1 /usr/chroot/lib/
cp -p /lib/libsepol.so.1 /usr/chroot/lib/
mkdir -p /usr/chroot/usr/lib
cp -p /usr/lib/libz.so.1 /usr/chroot/usr/lib/
cp -p /usr/lib/libgssapi_krb5.so.2 /usr/chroot/usr/lib/
cp -p /usr/lib/libkrb5.so.3 /usr/chroot/usr/lib/
cp -p /usr/lib/libk5crypto.so.3 /usr/chroot/usr/lib/
cp -p /usr/lib/libnss3.so /usr/chroot/usr/lib/
cp -p /usr/lib/libkrb5support.so.0 /usr/chroot/usr/lib/
cp -p /usr/lib/libplc4.so /usr/chroot/usr/lib/
cp -p /usr/lib/libplds4.so /usr/chroot/usr/lib/
cp -p /usr/lib/libnspr4.so /usr/chroot/usr/lib/
mkdir -p /usr/chroot/etc/
cp -p /etc/passwd /usr/chroot/etc/
cp -a /etc/ld.so* /usr/chroot/etc/
 
 
 
add sftp user
 
 
[root@aa-mysql-02 scusftp]# useradd sftplab -d /usr/chroot/home/sftplab -s /usr/bin/rssh
[root@aa-mysql-02 scusftp]# passwd sftplab
Changing password for user sftplab.
New password:
BAD PASSWORD: it does not contain enough DIFFERENT characters
BAD PASSWORD: is too simple
Retype new password:
Sorry, passwords do not match.
New password:
BAD PASSWORD: it does not contain enough DIFFERENT characters
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@aa-mysql-02 scusftp]#
 
 
 
 
 
 
 
ssh error
[root@aa-mysql-02 scusftp]# su sftplab
su: /usr/bin/rssh: Permission denied
[root@aa-mysql-02 scusftp]#
 
 
 

你可能感兴趣的:(centos,sftp,6.3,rssh)