I wanted to create a new user on my linux server so that he can access my postgres database through an ssh tunnel. However, I want him to restrict his access only to the ssh tunnel.
I followed these steps:
- login on server as
- Create a new user with
useradd new_user -M -s /bin/true
- Set a password with
- make sure that
PasswordAuthentication yesis set and uncomment in
- Restart ssh with
sudo systemctl reload sshd
- Logout from server and login to server with new user with
ssh -p 7822 new_user@my_address.com -N 5433:localhost:5432(I am using a2hosting as a provider, where I need to use port 7822 for ssh)
However, when I try to login I get the error
Permission denied, please try again.
When I do everything like above but change step 2 into
useradd new_user -m -d /home/new_user
I can successfully login with the new user, however, I then have the possibility to actually access command line, which I try to avoid. What am I doing wrong here?