mirror of
https://github.com/kingomarnajjar/desktop-environment.git
synced 2026-07-26 06:37:21 +10:00
sshdd
This commit is contained in:
parent
2f6e910856
commit
22a7371679
5 changed files with 10 additions and 113 deletions
|
|
@ -11,7 +11,7 @@ On a clean install of Ubuntu 18.10+ run as `root`:
|
|||
git clone https://github.com/sabrehagen/desktop-environment
|
||||
|
||||
# Start desktop environment
|
||||
desktop-environment/scripts/bootstrap-host.sh
|
||||
desktop-environment/scripts/bootstrap.sh
|
||||
```
|
||||
|
||||
## Forking
|
||||
|
|
|
|||
0
root/etc/services.d/sshd/down
Normal file
0
root/etc/services.d/sshd/down
Normal file
8
root/etc/services.d/sshd/run
Executable file
8
root/etc/services.d/sshd/run
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/execlineb -P
|
||||
|
||||
# Make sshd privilege separation directory
|
||||
foreground { s6-mkdir -p -m 750 /var/run/sshd }
|
||||
fdmove -c 2 1
|
||||
|
||||
# Run ssh in non-daemon mode
|
||||
if { /usr/sbin/sshd -t } /usr/sbin/sshd -D -e
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
# Script is run as root to create the host user
|
||||
if [ $USER != "root" ]; then
|
||||
echo "Host configuration script must be run as root!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO_ROOT=$(dirname $(realpath $0))/..
|
||||
|
||||
# Export desktop environment shell configuration
|
||||
export $($REPO_ROOT/scripts/environment.sh)
|
||||
|
||||
# Clone the desktop environment to the host
|
||||
git clone https://github.com/$DESKTOP_ENVIRONMENT_REGISTRY/$DESKTOP_ENVIRONMENT_CONTAINER $DESKTOP_ENVIRONMENT_REPOSITORY
|
||||
|
||||
# Fork setup to desktop environment configured location immediately
|
||||
if [ ! "$REPO_ROOT" -ef "$DESKTOP_ENVIRONMENT_REPOSITORY" ]; then
|
||||
$DESKTOP_ENVIRONMENT_REPOSITORY/scripts/bootstrap-host.sh
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Install utilities
|
||||
apt-get update -qq && \
|
||||
apt-get install -qq \
|
||||
curl \
|
||||
gosu \
|
||||
sudo \
|
||||
vcsh \
|
||||
xclip
|
||||
|
||||
# Enable password-less sudo for the sudo group
|
||||
echo "%sudo ALL=(ALL) NOPASSWD:ALL" | tee -a /etc/sudoers
|
||||
|
||||
# Increase max open files on host
|
||||
echo 'fs.file-max=1000000' >> /etc/sysctl.conf
|
||||
|
||||
# Increase max open file watchers on host
|
||||
echo 'fs.inotify.max_user_watches=1000000' >> /etc/sysctl.conf
|
||||
|
||||
# Increase file descriptor limit
|
||||
echo '* soft nofile 1000000' >> /etc/security/limits.conf
|
||||
echo '* hard nofile 1000000' >> /etc/security/limits.conf
|
||||
|
||||
# Remove existing group with id 999 if it is not the docker group
|
||||
getent group 999 | \
|
||||
grep -v docker | \
|
||||
cut -d: -f1 | \
|
||||
xargs groupdel
|
||||
|
||||
# Install Docker
|
||||
sh -c "$(curl -fsSL get.docker.com)" && \
|
||||
usermod -aG docker $DESKTOP_ENVIRONMENT_USER
|
||||
|
||||
# Install alacritty
|
||||
wget -O alacritty.deb https://github.com/jwilm/alacritty/releases/download/v0.2.8/Alacritty-v0.2.8_amd64.deb && \
|
||||
dpkg -i alacritty.deb && \
|
||||
rm alacritty.deb
|
||||
|
||||
# Make gosu accessible to all users
|
||||
chown :users /usr/sbin/gosu && \
|
||||
chmod +s /usr/sbin/gosu
|
||||
|
||||
# Allow docker containers to access the host's X server
|
||||
xhost local:docker
|
||||
|
||||
# Host user configuration
|
||||
HOST_USER=$DESKTOP_ENVIRONMENT_USER
|
||||
HOST_USER_ID=1000
|
||||
HOST_HOME=/$HOST_USER/home
|
||||
HOST_REPOSITORY=/$DESKTOP_ENVIRONMENT_CONTAINER
|
||||
|
||||
# Make the host user directory
|
||||
mkdir -p /$HOST_USER
|
||||
|
||||
# Create the host user group
|
||||
groupadd \
|
||||
--gid $HOST_USER_ID \
|
||||
$HOST_USER
|
||||
|
||||
# Create the host user
|
||||
useradd \
|
||||
--home-dir $HOST_HOME \
|
||||
--gid $HOST_USER_ID \
|
||||
--uid $HOST_USER_ID \
|
||||
$HOST_USER && \
|
||||
passwd $HOST_USER
|
||||
|
||||
# Add the host user to the docker group
|
||||
usermod \
|
||||
--append \
|
||||
--groups docker,sudo \
|
||||
$HOST_USER
|
||||
|
||||
# Start the desktop environment as the host user on system start
|
||||
echo "@reboot $HOST_USER $DESKTOP_ENVIRONMENT_REPOSITORY/scripts/start.sh" >> /etc/crontab
|
||||
|
||||
# Take ownership of all files under the user's directory
|
||||
chown -R $HOST_USER:$HOST_USER /$HOST_USER
|
||||
|
||||
# Install dotfiles configuration for host user
|
||||
gosu $HOST_USER vcsh clone git://github.com/sabrehagen/dotfiles-alacritty.git
|
||||
gosu $HOST_USER vcsh clone git://github.com/sabrehagen/dotfiles-autostart.git
|
||||
gosu $HOST_USER vcsh clone git://github.com/sabrehagen/dotfiles-kde.git
|
||||
gosu $HOST_USER vcsh clone git://github.com/sabrehagen/dotfiles-scripts.git
|
||||
|
||||
# Manually execute startup script to simulate host startup
|
||||
gosu $HOST_USER $HOST_HOME/.config/scripts/startup.sh
|
||||
|
||||
# Ensure the container user has ownership of the volumes before starting
|
||||
$REPO_ROOT/scripts/bootstrap-volumes.sh
|
||||
|
||||
# Recycle the desktop environment
|
||||
$DESKTOP_ENVIRONMENT_REPOSITORY/scripts/recycle.sh
|
||||
|
|
@ -61,4 +61,5 @@ until docker inspect $DESKTOP_ENVIRONMENT_CONTAINER | grep Status | grep -m 1 ru
|
|||
# Start desktop services
|
||||
docker exec $DESKTOP_ENVIRONMENT_CONTAINER s6-svc -u /run/s6/services/keychain
|
||||
docker exec $DESKTOP_ENVIRONMENT_CONTAINER s6-svc -u /run/s6/services/rescuetime
|
||||
docker exec $DESKTOP_ENVIRONMENT_CONTAINER s6-svc -u /run/s6/services/sshd
|
||||
docker exec $DESKTOP_ENVIRONMENT_CONTAINER s6-svc -u /run/s6/services/tmux
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue