mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 01:59:07 +00:00
getty: Make namespacing more obvious
Warn the user in the MOTD Add "(ns: getty)" or "(ns: sshd)" to the PS1 Use `agetty` and `-a root` to ensure we get a login shell when insecure Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
parent
e771cb82a1
commit
5fb025824f
@ -1 +1,4 @@
|
|||||||
Welcome to LinuxKit
|
Welcome to LinuxKit!
|
||||||
|
|
||||||
|
NOTE: This system is namespaced.
|
||||||
|
The namespace you are currently in may not be the root.
|
||||||
|
1
pkg/getty/etc/profile.d/namespace.sh
Normal file
1
pkg/getty/etc/profile.d/namespace.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
export PS1="(ns: getty) $PS1"
|
@ -31,14 +31,14 @@ start_getty() {
|
|||||||
# are we secure or insecure?
|
# are we secure or insecure?
|
||||||
loginargs=
|
loginargs=
|
||||||
if [ "$INSECURE" == "true" ]; then
|
if [ "$INSECURE" == "true" ]; then
|
||||||
loginargs="-n -l /bin/sh"
|
loginargs="-a root"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q -w "$tty" "$securetty"; then
|
if ! grep -q -w "$tty" "$securetty"; then
|
||||||
echo "$tty" >> "$securetty"
|
echo "$tty" >> "$securetty"
|
||||||
fi
|
fi
|
||||||
# respawn forever
|
# respawn forever
|
||||||
infinite_loop setsid.getty -w /sbin/getty $loginargs $line $speed $tty $term &
|
infinite_loop setsid.getty -w /sbin/agetty $loginargs $line $speed $tty $term &
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if we have /etc/getty.shadow
|
# check if we have /etc/getty.shadow
|
||||||
|
@ -1 +1,4 @@
|
|||||||
Welcome to LinuxKit
|
Welcome to LinuxKit!
|
||||||
|
|
||||||
|
NOTE: This system is namespaced.
|
||||||
|
The namespace you are currently in may not be the root.
|
||||||
|
1
pkg/sshd/etc/profile.d/namespace.sh
Normal file
1
pkg/sshd/etc/profile.d/namespace.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
export PS1="(ns: sshd) $PS1"
|
Loading…
Reference in New Issue
Block a user