Answer the question
In order to leave comments, you need to log in
How to close a user in his folder, chroot (CentOS)?
The task is this, there is a home / black_jack folder and when entering via ssh black_jack should not go beyond its user folder.
sshd configuration
Subsystem sftp internal-sftp
Match User black_jack
ChrootDirectory /home/black_jack
ForceCommand internal-sftp
AllowTCPForwarding no
X11Forwarding no
chown root /home/black_jack
Feb 6 17:52:02 mj257 sshd[8480]: Received signal 15; terminating.
Feb 6 17:52:02 mj257 sshd[8653]: Server listening on 0.0.0.0 port 22.
Feb 6 17:52:02 mj257 sshd[8653]: Server listening on :: port 22.
Feb 6 17:52:33 mj257 sshd[8655]: Accepted password for black_jack from IP port 52808 ssh2
Feb 6 17:52:33 mj257 sshd[8655]: pam_unix(sshd:session): session opened for user black_jack by (uid=0)
Feb 6 17:52:33 mj257 sshd[8658]: error: /dev/pts/3: No such file or directory
Feb 6 17:52:33 mj257 sshd[8658]: error: open /dev/tty failed - could not set controlling tty: No such file or directory
Feb 6 17:52:33 mj257 sshd[8655]: pam_unix(sshd:session): session closed for user black_jack
Answer the question
In order to leave comments, you need to log in
Feb 6 17:52:33 mj257 sshd[8658]: error: /dev/pts/3: No such file or directory
Feb 6 17:52:33 mj257 sshd[8658]: error: open /dev/tty failed - could not set controlling tty: No such file or directory
A person cannot be locked in a chroot via ssh.
For example, to log in, he needs to run the file /bin/bash. And there is no such file inside the root. Like all libraries.
You need a jailkit - it's a bit different, but do your job.
Read up on restricted shell, and rbash. In short, the user cannot set some variables, cannot cd, and can only run programs that have links in his home. And on the issue, show ls -la / home
and if my assumptions are correct, everything will become clear to you.
Well, perhaps alcohol is the most affordable and effective option. Since the case is metal, you don’t need to take a brush for metal, but the complete rag is the very thing!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question