If we are just allowing both on AllowUsers in file
/etc/ssh/sshd_config, new users won’t be allowed to access the server.
So!, lets edit it a add the new user. Find AllowUser line and add it there.
sudo nano /etc/ssh/sshd_config
This should look something like
AllowUsers bofh newuser
Save and Exit!
service ssh restart
Now the user!
addgroup --system filetransf
usermod -G filetransf username
chown root:root /home/username
chmod 755 /home/username
chown username:filetransf *
One of my clients was trying to connect, for the first time, on his brand new server..
Somehow he wasn’t able to connect….
He showed me the following *log/report*…
Status: Waiting to retry...
Status: Connecting to 37.XX.XX.XX...
Response: fzSftp started
Command: open "[email protected]" 22
Error: Server unexpectedly closed network connection
Error: Could not connect to server
and this is the auth.log on the server…
fatal: no matching mac found: client hmac-sha1,hmac-sha1-96,hmac-md5 server [email protected],hmac-sha2-256-$
Update the SFTP client – in this case filezilla -.
RSA host key for 188.166.XXX.XXX has changed and you have requested strict checking.
Host key verification failed.
So, I’v rebuild a droplet on DigitalOcean, and logically, when I tried to ssh it, SSH Keys were different…. Easy so solve it…
On a Mac OSX, on console, lets change to root
Lets edit known_hosts
Remove the entry of the respective host/ip.
Save and exit nano, exit root.. and ssh it! 🙂
I was trying to access via SFTP and SSH to a host, and I was getting some strange errors…
yesterday it was okay….
ssh [email protected]
[email protected]'s password:
Write failed: Broken pipe
I’v sshed with other user and changed to a root user.
Had to read the auth.log file to figure out what was going on.
[email protected]:/home/mike# tail -f /var/log/auth.log
So… this is what I got.
May 28 13:45:31 sd-11111 sshd: Accepted password for mike from 22.214.171.124 port 59004 ssh2
May 28 13:45:31 sd-11111 sshd: pam_unix(sshd:session): session opened for user mike by (uid=0)
May 28 13:45:31 sd-11111 systemd-logind: Removed session 4.
May 28 13:45:31 sd-11111 systemd-logind: New session 5 of user mike.
May 28 13:45:32 sd-11111 sshd: fatal: bad ownership or modes for chroot directory "/home/mike"
May 28 13:45:32 sd-11111 sshd: pam_unix(sshd:session): session closed for user mike
The solution was to do the following…
[email protected]:/home# sudo chown root:root /home/mike/
[email protected]:/home# sudo chmod 755 /home/mike/