Não é possível fazer o login depois de configurar um servidor vsftpd na caixa

0

Aqui está o script que eu usei para criar o servidor vsfpt, que estava se conectando bem com o FileZilla. Quando eu fiz o logout e tentei logar no dia seguinte, eu tive conexão recusada ??

Create an EC2 instance with a keypair (amazon AMI)
use the key to login via ssh. (ec2-user)
promote yourself to root user
sudo -i
update all packages
yum update -y
Install vsftpd package
yum install vsftpd
Add a new user (one per business partner) and set password
adduser sftpuser
make .ssh directory in the users home directory
su sftpuser  (change to new user) 
mkdir /home/sftpuser/.ssh
Create ssh keypair for user. Dont set any password. this will create id_rsa and id_rsa.pub
cd /home/sftpuser/.ssh
ssh-keygen -t rsa
copy content of id_rsa.pub into authorized_keys to be located in .ssh directory
cat id_rsa.pub >> authorized_keys
change file permissions and ownership
chmod 700 /home/sftpuser/.ssh
chmod 600 /home/sftpuser/.ssh/authorized_keys
Copy the private Key content to client machine. Test connecting using an sftp client (filezilla)
Change the permissions of the private key(for testing on local machine) to allow everyone.
revert back to root user .   CTRL + D 

Next we chroot user to specific directory and restrict shell access
groupadd sftpusers
usermod -aG sftpusers sftpuser
Create directory
mkdir /sftp
chmod 755 /sftp
chown root:sftpusers /sftp
Create subdirectory for user
mkdir /sftp/sftpuser
chown root:sftpusers /sftp/sftpuser
Modify /etc/sshd_config
vi /etc/ssh/sshd_config
comment line Subsystem sftp /usr/lib/....... and replace with
Subsystem sftp internal-sftp
Add following lines to end of file
Match Group sftpusers
ChrootDirectory /sftp/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
save and close file
change ownership of users home directory but retain permission on .ssh directory
chown root:root /home/sftpuser
chown -R sftpuser:sftpuser /home/sftpuser/.ssh
Restart sshd
/etc/init.d/sshd restart
Test sftp connection.

Gerou outra instância, configurou o mesmo script e perdeu a conexão novamente. Totalmente confuso!

    
por turkey 17.10.2017 / 12:05

0 respostas

Tags