Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hello everyone :
i want to know how to create user ,but you do not do with shell command,i try to update the file in /etc/passwd and /etc/group in order to create user,but the user who i create do not login. i want to know why?
There is a file called /etc/shadow, which is accessible only by root. The file will contain the encrypted password and other user info. You need to have an entry there for the user to log in. After you put an entry, use the "passwd" command to change the password of the user.
su <super user password>
adduser -g <groupname> <username>
passwd <username> <password>
like this..
Code:
su WiaasdQ1
adduser -g users bobo
passwd bobo BiMbO
that should make the needed entries...
then i would suggest making a directory in /home for them with permissions drwxr-xr-x:
edited:
for clairification...
su <super user password>
mkdir <desired /home directory>
chmod <permission> <desired /home directory>
example below:
/edited
Code:
su WiaasdQ1
mkdir /home/bobo
chmod 755 /home/bobo
oh ya, don't forget to make bobo owner and set group to users
that should take care of it.
to add a long list of users, consult other threads like this <click here> thread for making a script...
Originally posted by jlliagre That script isn't going to work, the new user isn't allowed to create a directory in /home, this should be done by root, and chowned to WiaasdQ1.
the example WAS su; "WiaasdQ1" was an example of a possible su password ;-)
perhaps start a new thread and post a subject line that says it all, saving potential contributers from having to read a bunch of posts now unrelated to your objective.
There are a few functions that may help. Using man check out putpwent and shadow. This will tell you what header files and functions to use for adding entries to /etc/passwd and /etc/shadow. As hk_linux mentioned there must be an entry in /etc/shadow to allow a user to login.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.