[Solved] Adding new user - switching users

If none of the more specific forums is the right place to ask

[Solved] Adding new user - switching users

Postby PsySc0rpi0n » 2019-12-27 22:53

Hello.

I'm using Debian Buster with Plasma Desktop and sddm.
I'm trying to add a new user to my Debian Buster. This is to be an account to my daughter to start exploring and practicing to type with the laptop keyboard and start getting used with online searches, etc.

So I did the following command in terminal:
Code: Select all
sudo useradd -m -d /home/homefolder newuser


Then I switched to 'root' user and set a password to the newly created user using:
Code: Select all
passwd newuser


Then I went back to my normal user and tried to switch to the newly created user I used:
Code: Select all
su -s newuser


and enter my normal user password and I get the following error:
Code: Select all
su: failed to execute newuser: No such file or directory


and if I use the newuser password in the above command I get a different error:
Code: Select all
su: Authentication failure


If I issue:
Code: Select all
cat /etc/passwd


I get the following:
Code: Select all
newuser:x:1003:1004::/home/homefolder:/bin/sh


Why can't I switch to my daughter's newly created account?
Note: I already tried in a new terminal session. Also 'newuser' and 'homefolder' are just generic names I used. But I was consistent changing the names, so the generic names I used, are correctly replace in the correct places here in my post.
Last edited by PsySc0rpi0n on 2019-12-28 11:17, edited 1 time in total.
User avatar
PsySc0rpi0n
 
Posts: 138
Joined: 2012-10-24 13:54
Location: Portugal

Re: Adding new user - switching users

Postby Head_on_a_Stick » 2019-12-27 23:32

Run adduser(8) instead, this isn't Arch.

You will have to delete that abortive initial attempt first though:
Code: Select all
# deluser
User avatar
Head_on_a_Stick
 
Posts: 11021
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Adding new user - switching users

Postby PsySc0rpi0n » 2019-12-28 00:12

I'm trying to use:
Code: Select all
sudo adduser --home /home/homefolder --shell bash newuser


and I get the following error:
Code: Select all
adduser: Please enter a username matching the regular expression configured
via the NAME_REGEX configuration variable.  Use the `--force-badname'
option to relax this check or reconfigure NAME_REGEX.


What am I missing now?
User avatar
PsySc0rpi0n
 
Posts: 138
Joined: 2012-10-24 13:54
Location: Portugal

Re: Adding new user - switching users

Postby Head_on_a_Stick » 2019-12-28 00:17

Just run
Code: Select all
# adduser newuser

Nothing else.
User avatar
Head_on_a_Stick
 
Posts: 11021
Joined: 2014-06-01 17:46
Location: /dev/chair

Adding new user - switching users

Postby PsySc0rpi0n » 2019-12-28 08:58

Head_on_a_Stick wrote:Just run
Code: Select all
# adduser newuser

Nothing else.
But I don't want the home dir the same as the user name and the default terminal application I want it to be bash. What is wrong with the command?

Sent from my SM-G935F using Tapatalk
User avatar
PsySc0rpi0n
 
Posts: 138
Joined: 2012-10-24 13:54
Location: Portugal

Re: Adding new user - switching users

Postby arzgi » 2019-12-28 09:30

Code: Select all
ADDUSER(8)                  System Manager's Manual                 ADDUSER(8)

NAME
       adduser, addgroup - add a user or group to the system

SYNOPSIS
       adduser  [options]  [--home  DIR]  [--shell  SHELL]  [--no-create-home]
       [--uid ID] [--firstuid ID] [--lastuid ID] [--ingroup GROUP | --gid  ID]
       [--disabled-password]  [--disabled-login]  [--gecos  GECOS]  [--add_ex‐
       tra_groups] user
arzgi
 
Posts: 514
Joined: 2008-02-21 17:03
Location: Finland

Adding new user - switching users

Postby PsySc0rpi0n » 2019-12-28 10:39

arzgi wrote:
Code: Select all
ADDUSER(8)                  System Manager's Manual                 ADDUSER(8)

NAME
       adduser, addgroup - add a user or group to the system

SYNOPSIS
       adduser  [options]  [--home  DIR]  [--shell  SHELL]  [--no-create-home]
       [--uid ID] [--firstuid ID] [--lastuid ID] [--ingroup GROUP | --gid  ID]
       [--disabled-password]  [--disabled-login]  [--gecos  GECOS]  [--add_ex‐
       tra_groups] user
Yes, I know. I read it before coming here.
So, what is wrong with the command?

I give it no options, give 2 arguments in the correct sequence, I guess, which are --home and --shell, then I give the user name. What is wrong here?

Sent from my SM-G935F using Tapatalk
User avatar
PsySc0rpi0n
 
Posts: 138
Joined: 2012-10-24 13:54
Location: Portugal

Re: Adding new user - switching users

Postby Head_on_a_Stick » 2019-12-28 11:10

This works for me:
Code: Select all
# adduser --home /home/homefolder --shell /bin/bash newuser

No idea why you're having problems.
User avatar
Head_on_a_Stick
 
Posts: 11021
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Adding new user - switching users

Postby PsySc0rpi0n » 2019-12-28 11:17

Head_on_a_Stick wrote:This works for me:
Code: Select all
# adduser --home /home/homefolder --shell /bin/bash newuser

No idea why you're having problems.


Ok, I got it.
I didn't used real names here but the problem was that I was using lower and capital letters in username which I can't according to the default set in NAME_REGEX.

Solved.
Thanks
User avatar
PsySc0rpi0n
 
Posts: 138
Joined: 2012-10-24 13:54
Location: Portugal


Return to General Questions

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable