Created
March 20, 2018 00:27
-
-
Save pawelpanek81/fe7d68c537efc8d35b2b63f56788bebd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Dodanie użytkowników | |
```#!/bin/bash | |
while read konto; | |
do | |
n=$(echo $konto | cut -d : -f 1) | |
l=$(echo $konto | cut -d : -f 2) | |
p=$(echo $konto | cut -d : -f 3) | |
adduser $l --disabled-password --gecos "" | |
chfn -f "$n" $l | |
echo "$l:$p" | chpasswd | |
done``` | |
###Wynik | |
```root@pawel:/home/pawel/Documents# cat plik_dev | ./add_users.sh | |
Adding user `janko' ... | |
Adding new group `janko' (1001) ... | |
Adding new user `janko' (1001) with group `janko' ... | |
Creating home directory `/home/janko' ... | |
Copying files from `/etc/skel' ...``` | |
#Usuniecie | |
```#!/bin/bash | |
while read konto; | |
do | |
l=$(echo $konto | cut -d : -f 2) | |
deluser --remove-home --quiet $l | |
done``` | |
###Wynik | |
```root@pawel:/home/pawel/Documents# cat plik_dev | ./remove_users.sh``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment