diff options
| author | Craig Jennings <c@cjennings.net> | 2024-11-29 15:23:49 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-11-29 15:23:49 -0600 |
| commit | 5daddeb0848a1e3f3dfc607b111fdc6cc52186fa (patch) | |
| tree | aa76cd00cab7c1a764737596b50a33932a4779d7 /init | |
| parent | 916e999777ecdab646e32c7ba4939f45f1bcc0e2 (diff) | |
avoid hardcoding network interface
Diffstat (limited to 'init')
| -rwxr-xr-x | init | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1,12 +1,21 @@ #!/bin/sh + +# update and install tmux and git pacman -Sy --noconfirm pacman -S --noconfirm tmux git -systemctl start sshd +# change the root password echo "root:welcome" | chpasswd + +# find the hostname from the file hostname=$(</etc/hostname) -ipaddress=$(ip addr show wlan0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1) +# identify which interface is up, then find the ip address +interface_up=$(ip addr show | grep "state UP" -B2 | head -n1 | awk '{print $2}' | sed 's/://') +ipaddress=$(ip addr show $(interface_up) | grep 'inet ' | awk '{print $2}' | cut -d/ -f1) + +# start the ssh daemon +systemctl start sshd echo ""; echo ""; echo "init complete. " echo "you may ssh root@$hostname or ssh root@$ipaddress using the password 'welcome'" |
