Results 1 to 6 of 6
Hello...I am a beginner
I want to write a script name myuseradd
I want to add user without useing useradd command
1- Check if user is root. If not the ...
- 11-01-2011 #1Just Joined!
- Join Date
- Oct 2011
- Posts
- 11
Useradd....without useradd comman......
Hello...I am a beginner
I want to write a script name myuseradd
I want to add user without useing useradd command
1- Check if user is root. If not the script cannot be run and it exits.
2- Check the number of arguments. If none the script exits.
Can someone give me a clue ???
thanks Loooot
- 11-01-2011 #2
hint:
Code:if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1 fi
linux user # 503963
- 11-01-2011 #3Just Joined!
- Join Date
- Oct 2011
- Posts
- 11
- 11-01-2011 #4
In puppet, it would look like this:
See? No useraddCode:user { 'abdelellah': ensure => 'present', comment => 'Abdelellah', uid => '1000', gid => '10', home => '/home/abdelellah', shell => '/bin/bash', password => '<Abdelellah_HASH>', managehome => 'true', }
But I assume, what you are looking for is directly editing the files containing the account information.
And as this looks like a homework question to me, I suggest
- you read the man page of useradd to figure out, which files contain the account informations
- then look at the files
- then decide how you would implement your own useradd
Code:man useradd
You must always face the curtain with a bow.
- 11-01-2011 #5linux user # 503963
- 11-02-2011 #6
This sounds like a homework question, which are not allowed on this forum. I am closing this thread.
DISTRO=Arch
Registered Linux User #388732



