LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to add user account(non-root)? (https://www.linuxquestions.org/questions/slackware-14/how-to-add-user-account-non-root-755349/)

cola 09-15-2009 09:09 AM

How to add user account(non-root)?
 
What's the best way to add user account in slackware 12.2?
I did this.
Code:

useradd user
But there is nothing except ftp in /home/.

GrapefruiTgirl 09-15-2009 09:16 AM

Read the man page for the 'useradd' command. You have the right command, but need to specify more than just the username, in order for all the usual stuff to happen.

For example, you want to specify whether or not to create the home directory, and whether or not to use the contents of /etc/skel as the basic home directory contents. Also, you'll want to specify what groups the user will be a member of, including the default group. If the user is to have his own group, you'll need to create that group too, using the "groupadd" or "addgroup" command.

Sasha

cola 09-15-2009 09:25 AM

Quote:

Originally Posted by GrapefruiTgirl (Post 3683638)
Read the man page for the 'useradd' command. You have the right command, but need to specify more than just the username, in order for all the usual stuff to happen.

For example, you want to specify whether or not to create the home directory, and whether or not to use the contents of /etc/skel as the basic home directory contents. Also, you'll want to specify what groups the user will be a member of, including the default group. If the user is to have his own group, you'll need to create that group too, using the "groupadd" or "addgroup" command.

Sasha

Hello,
man useradd
Code:

bash: man: command not found
Can you post the complete command to add user account?

bgeddy 09-15-2009 09:26 AM

Although, as Sasha says, you have the right command - you may find it easier using the "adduser" script which will create all the directories for you. As root run :
Quote:

adduser user
to add the user "user" to the system. Now you have created a user without creating it's home directory you may find it easier to "userdel user" then run "adduser user" on your system.

onebuck 09-15-2009 09:28 AM

Hi,

Quote:

Originally Posted by cola (Post 3683627)
What's the best way to add user account in slackware 12.2?
I did this.
Code:

useradd user
But there is nothing except ftp in /home/.

I prefer the 'adduser' that is the frontend for 'useradd' that has been adapted for Slackware. Take a look at the script '/usr/sbin/adduser'. It is well documented.

Be sure to add your user to the groups;

Quote:

users floppy audio video cdrom plugdev power netdev
You can use the up-arrow for the recommended groups after you add the user to the 'users' group. You will see the following;
Quote:

Initial group [ users ]:
Additional UNIX groups:

Users can belong to additional UNIX groups on the system.
For local users using graphical desktop login managers such
as XDM/KDM, users may need to be members of additional groups
to access the full functionality of removable media devices.

* Security implications *
Please be aware that by adding users to additional groups may
potentially give access to the removable media of other users.

If you are creating a new user for remote shell access only,
users do not need to belong to any additional groups as standard,
so you may press ENTER at the next prompt.

Press ENTER to continue without adding any additional groups
Or press the UP arrow to add/select/edit additional groups
:audio cdrom floppy plugdev video power netdev <<< pressed up-arrow to get suggested groups
You can always escape out with the 'ctl-c'.

GrapefruiTgirl 09-15-2009 09:28 AM

Thanks bgeddy,

I should have mentioned, not all Linuxes have both of "adduser" and "useradd" -- rather, I believe there's usually only one of them (the non-script version)

Sorry for that omission, Cola :)

Sasha

sahko 09-15-2009 09:29 AM

Its preferable to use adduser instead.
But even if you decide to use useradd you have to read the manpage first.

Woodsman 09-15-2009 10:53 AM

You can create a file named /etc/default/useradd that will work with the useradd command. The file will look like this:

# Begin /etc/default/useradd

GROUP=100
HOME=/home/users
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel

# End /etc/default/useradd

When you add a user this file is read and the useradd command will create the user's home directory and prepopulate with anything found in /etc/skel.

You also can user kuser in KDE. The utility will provide some check boxes and text boxes to ensure the user's home directory is created as you want.

cola 09-15-2009 11:36 AM

Quote:

Originally Posted by Woodsman (Post 3683763)
You can create a file named /etc/default/useradd that will work with the useradd command. The file will look like this:

# Begin /etc/default/useradd

GROUP=100
HOME=/home/users
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel

# End /etc/default/useradd

When you add a user this file is read and the useradd command will create the user's home directory and prepopulate with anything found in /etc/skel.

You also can user kuser in KDE. The utility will provide some check boxes and text boxes to ensure the user's home directory is created as you want.

Using kuser is easier.
What group should be selected from kuser.
I selected adm.
Now from non-root user account if i type kuser , i get a message.
Code:

Error opening /etc/shadow for reading.
id
Code:

uid=500(user1) gid=100(users) groups=4(adm),100(users)

Woodsman 09-16-2009 07:13 PM

You can run kuser only as root. When trying to run kuser from the KDE Run tool, kuser should prompt you for the root password. You also can run kuser with the kdesu command, but you still need to provide the root password.


All times are GMT -5. The time now is 04:34 AM.