Results 1 to 6 of 6

Thread: Unable to login as nonroot user. Remote SSH login works just fine.

  1. #1
    Join Date
    2020-Feb
    Posts
    4

    Question (SOLVED) Unable to login as nonroot user. Remote SSH login works just fine.

    root@kali:~# whoami
    root
    root@kali:~# ssh [email protected]
    [email protected]'s password:
    Linux kali 5.3.0-kali2-amd64 #1 SMP Debian 5.3.9-3kali1 (2019-11-20) x86_64


    The programs included with the Kali GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.


    Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    Last login: Mon Feb 17 12:58:42 2020 from 10.10.10.10
    dude@kali:~$ ifconfig
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 10.10.10.2 netmask 255.255.255.0 broadcast 10.10.10.255

    root@kali:~# hostnamectl
    Static hostname: kali
    Icon name: computer-vm
    Chassis: vm
    Machine ID: 338a1d7d7a4f4f78927a994865eee4aa
    Boot ID: 6be3bd3d3fa944f1a17c4c7c7bd8c8e4
    Virtualization: vmware
    Operating System: Kali GNU/Linux Rolling
    Kernel: Linux 5.3.0-kali2-amd64
    Architecture: x86-64



    Hello! Please help me to resolve this problem. I'm quite a noob in linux
    User was added via useradd command. So i'm unable to login using GUI as i do as @root. When i enter login and password for GUI seems linux accept them but instead to load desktop it becomes black for a second and force me back to login screen again.
    apt-get update'ed, rebooted. Same thing.
    Last edited by Podranok; 2020-02-19 at 08:42. Reason: Solved

  2. #2
    Join Date
    2020-Feb
    Posts
    10
    User was added via useradd command. So i'm unable to login using GUI as i do as @root. When i enter login and password for GUI seems linux accept them but instead to load desktop it becomes black for a second and force me back to login screen again.
    There are two ways to add a user: useradd and adduser. The former, which you used, does do some things, like creating a line in /etc/passwd:

    Code:
    $ sudo useradd testme
    $ grep testme /etc/passwd
    testme:x:1001:1001::/home/testme:/bin/sh
    But even though it creates the user, it doesn't do other helpful things like create a user directory.

    Code:
    $ ls /home
    kali
    My guess is that you can't log in locally because your GUI wants to be able to write into the home directory which doesn't exist. You should be using adduser instead, which will do things like create the user directory in /home and provide a password to the newly-created user.

    More info at this StackExchange answer.

  3. #3
    Join Date
    2020-Feb
    Posts
    4
    Hi Buglab! I did as you suggested(deleted user and added it again via adduser but it doesn't help). The result is the same: can login via ssh, can't do it via GUI. I've noticed warning about home directory rights. Could it be the reason? How can i fix that please?

    root@kali:~# adduser dude
    Adding user `dude' ...
    Adding new group `dude' (1000) ...
    Adding new user `dude' (1000) with group `dude' ...
    The home directory `/home/dude' already exists. Not copying from `/etc/skel'.
    adduser: Warning: The home directory `/home/dude' does not belong to the user you are currently creating.
    New password:
    Retype new password:
    passwd: password updated successfully
    Changing the user information for dude
    Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
    Is the information correct? [Y/n] y
    root@kali:~#

  4. #4
    Join Date
    2020-Feb
    Posts
    4
    root@kali:/# cd /home
    root@kali:/home# ls -l
    total 4
    drwxr-xr-x 2 root root 4096 Feb 17 12:45 dude
    root@kali:/home# chmod 777 dude
    root@kali:/home# ls -l
    total 4
    drwxrwxrwx 2 root root 4096 Feb 17 12:45 dude
    root@kali:/home#

    I've changed rights on /home/dude directory and GUI allows user Dude to login. Hands down!
    Thx all, topic can be closed.

  5. #5
    Join Date
    2020-Feb
    Posts
    10
    Glad you got it working. However, from a security perspective, having your home directory writeable by anyone on the system is not a good idea.

    The real problem with your setup is that the home directory "dude" is owned by root. If it were owned by "dude", as it should be, then the original permissions of 755 would be sufficient. So try `sudo chown dude:dude /home/dude` and then set the permissions back to 755.

  6. #6
    Join Date
    2020-Feb
    Posts
    4
    Yeah i know about security issue but it's just a Virtual Lab.

Similar Threads

  1. I can't login with root user
    By Peterto in forum TroubleShooting Archive
    Replies: 6
    Last Post: 2021-02-05, 00:05
  2. Unable to login to new user after creation in kali
    By dogman in forum TroubleShooting Archive
    Replies: 1
    Last Post: 2020-01-29, 06:28
  3. Enable SSH Remote Login
    By alex408 in forum TroubleShooting Archive
    Replies: 0
    Last Post: 2019-12-04, 01:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •