Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to create user in Linux By shell commands?

Hi
i need to create user by shell commands in linux.
help me .
thanks a lot.

Comments

  • kc2keokc2keo Member Posts: 110
    [b][red]This message was edited by kc2keo at 2005-12-18 10:52:8[/red][/b][hr]
    : Hi
    : i need to create user by shell commands in linux.
    : help me .
    : thanks a lot.
    :
    :

    NOTE: I'm using '' for putting commands inside. So... 'commandhere'.

    Well, assuming your using the popular bash shell and should work in other shells you will want to use the useradd command. To find out more about the useradd command issue 'man useradd' or 'info useradd' It should give you a example of how to add a user to Linux. Dont forget that you will need to have root access to add a user in most cases unless you changed permissions for that specific user but by default I think you need root access. You could either login as root from init level 3 (means when you boot into linux you start directly to the shell and then you startx manually) or just switch to a super user (means the same as root) from the user $ shell. You switch over to it by going '$>su'. It will then prompt you for your root password. Enter the appropriate root password you set to get to root shell. Normally in the bash shell it will have a pound sign like #>. It would go something like 'useradd username'. Then you'd want to add a password to that user like 'passwd username' then it prompts you to add a password to that user. I belive the passwd file is in /etc/passwd depending on what distro your using. Of course theres more to the useradd and passwd command so thats what the man or info pages are for. The man pages are short for manual pages. They are flat files located on your harddrive in a special path. Most if not all Linux systems have man included. The info command I think is more extensive with the information. There are more information commands other than man in info though. If you wanna find out more about man just type 'man man' in your shell. For info its 'info info'. If what I explained here in this reply isnt good enough you should do some searches with your favorite search engine.

    I will also suggest that you use a GUI program like webmin (http://www.webmin.com/). In a short description its a admistering tool that you can access over the web via browser with SSL encryption. It quite nice. You could also add/remove users like that. The problem with those tools is that your not learning how to use the commands. I recommend learning it the hard way first :)

    --George

  • HarshanduHarshandu Member Posts: 7
    : Hi
    : i need to create user by shell commands in linux.
    : help me .
    : thanks a lot.
    :
    :

    Hello,
    You can create the user by using the command 'useradd'.

    Regards,
    Harsh.
Sign In or Register to comment.