9

I created a new user on ubuntu 10 username: codeuser

There is an existing user called "admin". Now, my problem is that I cannot directly connect to the server using the codeuser credentials. But, I can SSH in through "admin" and then su (change the user to codeuser) and it works. How do I get the shell access to the codeuser user ?

This is the output of my files:

cat /etc/passwd

root:x:0:0:root:/root:/bin/bash
www-data:x:33:33:www-data:/var/www:/bin/bash
admin:x:1000:1000:,,,:/home/admin:/bin/bash
ftp:x:107:65534::/home/ftp:/bin/false
codeuser:x:1004:33::/home/codeuser:/bin/bash


cat /etc/group

root:x:0:
www-data:x:33:
codeuser:x:1005:



iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination          
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:mysql  

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination          

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
| improve this question | | | | |
  • 2
    Check /etc/ssh/sshd_config for allowed users list. If it is OK, the problem is more complex. Try to connect as "ssh codeuser@your-server -v" – HUB Apr 1 '11 at 17:08
  • When you ssh in as codeuser what error message is displayed after entering the codeuser credentials ? – user9517 Apr 1 '11 at 17:09
  • @HUB it worked [can you please make it an answer, so I can accept it ?]. Strange, I thought I checked that file. Now, do I have to add a user to that file everytime I create a new user ? Isn't there a automatic script / command ? – Stewie Apr 1 '11 at 17:13
9

Check /etc/ssh/sshd_config for allowed users list. If it is OK, the problem is more complex. Try to connect as "ssh codeuser@your-server -v"

| improve this answer | | | | |
  • My sshd_config file does not have any users defined, but I can SSH in as root, and user1, but not user2 – wruckie May 21 '18 at 16:34
  • @wruckie In my case, the shell assigned to the user was not correct. If it is suspected, please try editing /etc/passwd. My problem had been solved by changing /usr/bin/bash to /bin/bash. (cf. New Users Can't Login via SSH) – ynn Nov 28 '19 at 10:48
2

Check /var/log/auth.log for any errors. Did you assign codeuser a password using the passwd command?

| improve this answer | | | | |
0

A quite old post but still valid. Worth checking logs as Marco Ramos mentioned above. In my case with Debian 9 a group must granted with permissions /var/log/auth.log

Nov 23 23:10:46 AreNAS sshd[6765]: User are from 192.168.0.36 not allowed because none of user's groups are listed in AllowGroups
| improve this answer | | | | |
0

On Ubuntu 18.04 I had simply neglected to add my client's public key to the authorized keys file (this post got me thinking about the authorized_keys file: https://superuser.com/a/1337741/413936).

chmod 700 ~/.ssh
cd ~/.ssh
touch authorized_keys
chmod 600 authorized_keys

Then add your client's public key to authorized_keys file.

For whatever reason though, I didn't need to add PasswordAuthentication yes to /etc/ssh/sshd_config on Ubuntu 18.04.3 LTS as other people have mentioned. To be clear, mine is commented out like this # PubkeyAuthentication yes and I restarted both ssh and sshd services and was still able to ssh in.

| improve this answer | | | | |
-1

Try to check /var/log/auth.log for possible error messages.

Also, ask the user to try to login with ssh -v, for more verbose output.

Hope this helps!

| improve this answer | | | | |
-2

On new Debian installations (may be even other distributions) you have to enable password login. It started to happen recently. AllowUsers won't help you, PermitRootLogin yes won't help you.

Default configuration in /etc/ssh/sshd_config is:

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes

but it won't let you ssh to it with plain text password. You have to uncomment it, restart sshd, insert your ssh key and comment it back or leave it enabled.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.