1

I currently have an issue, what I am trying to do is disable the root login and use ssh to login as a new user, then su to root when needed.

I am unable to actually allow the user to login through root. I am able to login through SSH on root, but not the user I have made.

I have used the AllowUser command, still no luck.

Anything there is to fix this?

I am using CentOS 07.

$ grep <newuser> /etc/passwd
<newuser>:x:1000:1000::/home/<newuser>:/bin/bash]


/usr/sbin/sshd -Dd
debug1: sshd version OpenSSH_6.4, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type ECDSA
debug1: private host key: #1 type 3 ECDSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-Dd'
Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Bind to port 22 on 0.0.0.0 failed: Address already in use.
debug1: Bind to port 22 on ::.
Bind to port 22 on :: failed: Address already in use.
Cannot bind any address.
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Datsun
  • 11
  • 3
  • 1
    Please paste the output of the following commands: 1) `grep /etc/passwd` 2) `grep /var/log/secure` – Sreeraj Nov 28 '14 at 04:53
  • 1
    The output of `ssh -v` (`-vv`, `-vvv`) from client and `sshd -d -oUsePrivilegeSeparation=no` (`-dd`, `-ddd`) on the remote side might also shed some light on your problem. – peterph Nov 28 '14 at 10:43
  • Added outputs on grep /etc/passwd, grep /var/log/secure has a tremendous amount of outputs. .ssh -V told me I'm running OpenSSH, and OpenSSL, while sshd -D told me sshd re-exec requires execution with an absolute path – Datsun Nov 29 '14 at 04:57
  • @Datsun try `/usr/sbin/sshd -d -o ...` (see [this q](http://unix.stackexchange.com/questions/109380/why-does-sshd-requires-an-absolute-path) about absolute path). – muru Nov 29 '14 at 06:02
  • added sudo /usr/sbin/sshd -Dd – Datsun Nov 29 '14 at 20:03
  • How are you authenticating, with a password or with a key? If it's a key, have you [checked ALL the permissions](http://unix.stackexchange.com/questions/16978/how-to-make-password-less-login-work)? Post the output of `ssh -vv [email protected]`. – Gilles 'SO- stop being evil' Nov 29 '14 at 20:34
  • Does the entry in `/etc/passwd` really end with `/bin/bash]`? If so, that's your problem: remove the `]`. – Gilles 'SO- stop being evil' Nov 29 '14 at 20:36

2 Answers2

1

Perhaps you've forgotten to assign the user's shell?

That can be done like so:

useradd -s /bin/bash gdea73

It may be something different entirely, but I do recall making the aforementioned error myself at some point in the past.

gdea73
  • 46
  • 3
0

I fixed it, thanks for your help guys! My issue was that I installed the key on root, and did not do the same for my user. I went ahead and followed the following tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2 But making sure I was on the new user, and in the users home directory, followed ALL steps and it worked! All I had to do was import the keys, and run PuttyGen to change their settings for Putty to work!

Datsun
  • 11
  • 3