And i did what the sad and the useradd, userdel and pass scripts work.
Dis is what i have
a list with users saved a userlist.txt
uderadd script:
#!/bin/sh
for i in more userlist.txt
do
echo $i
useradd $i
done
Then i type in the terminal ./useradd.txt
Then the users are added.
then i have a password script:
#!/bin/sh
for i in more userlist.txt
do
echo $i
echo $i"123" | passwd “$i” --stdin
echo; echo “User $username’s password changed!”
done
then the user has his name with 123 as password.
Now in the comment function on the site some one posted a script like this:
#!/bin/sh
for i in more userlist.txt
do
echo $i
echo $i | change -d 0 “$i”
echo; echo “User $i will be forced to change password on next login!”
done
then users had to change there password when the log in the first time.
And i tried that script but then i get this massage:
nurealam
./pass1.txt: line 5: change: command not found
Now my question is what is wrong with that script ?
All other scripts work fine.
Userdel script i have:
#!/bin/sh
for i in more userlist.txt
do
echo $i
userdel -r $i
done
I now changed it to chage and now it works.
When i log in with the user i need to change the password.
But it wont log in because there is now home folder.
i get the massage:
Cannot enter home directory. Using /.
When i look in the directory the home folders are not there.
Can the code be changed so that is greats the home folders to ?
If so what do i need to change in the code ?
Dint no i can just add the useradd options.
I already played with the options in the terminal.
So then i will go and play around with the useradd options in the script.