123456789101112131415161718192021222324 |
- #!/bin/bash
- # Create the walkingo user and group to match the uid and gid
- # of the mounted /home/walkingo/logdir directory
- cd /home/walkingo || exit 1
- [ -d logdir ] || exit 1
- wouid=`/usr/bin/stat -c %u logdir`
- wogid=`/usr/bin/stat -c %g logdir`
- /usr/sbin/groupadd -g $wogid walkingo
- /usr/sbin/useradd -g walkingo -u $wouid -s /bin/bash walkingo
- /bin/cp -a /etc/skel/.bash* /etc/skel/.profile .
- # Give the new walkingo user sudo permissions in the docker
- /usr/sbin/adduser walkingo sudo > /dev/null
- echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
- # Chown the files in the new user's homedir (pre-populated by
- # the docker image), except for the mounted logdir
- /usr/bin/find . -name logdir -prune -o -exec chown ${wouid}:${wogid} {} \;
- # Run screen as the new walkingo user, ready to be attached
- echo "docker container ready; use ./attach-docker to connect to it."
- /bin/su walkingo -c "screen -D -m"
|