Skip to content

Commit b57589c

Browse files
committed
Add user script
1 parent 005be43 commit b57589c

File tree

6 files changed

+51
-4
lines changed

6 files changed

+51
-4
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
system/etc/passwd
2+
system/etc/shadow

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ RUN git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/t
3333
RUN sed -i 's/robbyrussell/powerlevel9k\/powerlevel9k/' ~/.zshrc
3434
RUN sed -i 's/ git/ git zsh-syntax-highlighting zsh-autosuggestions colored-man-colored/' ~/.zshrc
3535

36-
RUN cp ~/.zshrc ~/aa && echo export TERM="xterm-256color" > ~/.zshrc && cat ~/aa >> ~/.zshrc && rm ~/aa
37-
38-
VOLUME /etc
36+
RUN cp ~/.zshrc ~/aa && \
37+
echo export TERM="xterm-256color" > ~/.zshrc && \
38+
cat ~/aa >> ~/.zshrc && rm ~/aa

execImage.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ docker run --hostname local \
44
--rm \
55
-v voluser:/home/voluser \
66
-v "$(pwd)"/script:/script \
7+
-v "$(pwd)"/system:/system \
78
-ti nekrofage/ubuntu1804test:latest \
8-
/bin/zsh
9+
/bin/zsh -c "cp /system/etc/passwd /etc/; cp /system/etc/shadow /etc/; /bin/zsh"

script/configuser.sh

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ USER=$1
44

55
echo "User setup"
66

7+
cp /system/etc/passwd /etc/passwd
8+
cp /system/etc/shadow /etc/shadow
9+
710
useradd -m -s /bin/zsh -d /home/voluser/$USER $USER
811
echo "$USER:mot2passe" | chpasswd
912
adduser $USER sudo
@@ -13,3 +16,6 @@ sed -i 's/ export ZSH=\"\/root\/.oh-my-zsh\"/export ZSH=\"\/home\/voluser\/'$US
1316
cp -R ~/.oh-my-zsh /home/voluser/$USER
1417
chown -R $USER:$USER /home/voluser/$USER/.oh-my-zsh
1518
chown -R $USER:$USER /home/voluser/$USER/.zshrc
19+
20+
cp /etc/passwd /system/etc/passwd
21+
cp /etc/shadow /system/etc/shadow

system/etc/passwd

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root:x:0:0:root:/root:/usr/bin/zsh
2+
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
3+
bin:x:2:2:bin:/bin:/usr/sbin/nologin
4+
sys:x:3:3:sys:/dev:/usr/sbin/nologin
5+
sync:x:4:65534:sync:/bin:/bin/sync
6+
games:x:5:60:games:/usr/games:/usr/sbin/nologin
7+
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
8+
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
9+
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
10+
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
11+
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
12+
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
13+
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
14+
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
15+
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
16+
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
17+
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
18+
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
19+
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin

system/etc/shadow

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root:*:17869:0:99999:7:::
2+
daemon:*:17869:0:99999:7:::
3+
bin:*:17869:0:99999:7:::
4+
sys:*:17869:0:99999:7:::
5+
sync:*:17869:0:99999:7:::
6+
games:*:17869:0:99999:7:::
7+
man:*:17869:0:99999:7:::
8+
lp:*:17869:0:99999:7:::
9+
mail:*:17869:0:99999:7:::
10+
news:*:17869:0:99999:7:::
11+
uucp:*:17869:0:99999:7:::
12+
proxy:*:17869:0:99999:7:::
13+
www-data:*:17869:0:99999:7:::
14+
backup:*:17869:0:99999:7:::
15+
list:*:17869:0:99999:7:::
16+
irc:*:17869:0:99999:7:::
17+
gnats:*:17869:0:99999:7:::
18+
nobody:*:17869:0:99999:7:::
19+
_apt:*:17869:0:99999:7:::

0 commit comments

Comments
 (0)