Merge branch 'main' of ssh://git.six9.net:8222/moonq/ssh-box
This commit is contained in:
@@ -14,4 +14,5 @@ First start:
|
||||
- example: `vim users/2000-user1` <- copy id_rsa.pub contents there
|
||||
- use UID >=2000
|
||||
- you can also use the `user-add` script
|
||||
- the ~/shared/ folder for each is user is also listed in /shared/[user] symlink
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ function validate_users() {
|
||||
|
||||
cd /var/ssh-box/users
|
||||
validate_users
|
||||
|
||||
mkdir -p /shared/
|
||||
for file in *; do
|
||||
if [[ "$file" =~ ^([0-9]+)-([a-z][a-z0-9_]*)$ ]]; then
|
||||
uid=${BASH_REMATCH[1]}
|
||||
@@ -83,10 +83,18 @@ for file in *; do
|
||||
rm -f "/home/$user/.ssh/authorized_keys"
|
||||
get_readme > "/home/$user/README.md"
|
||||
mkdir -p "/home/$user/shared" "/home/$user/private"
|
||||
ln -sfT "/shared" "/home/$user/public"
|
||||
chown -R "$user":box "/home/$user/shared"
|
||||
chown -R "$user":"$user" "/home/$user/private"
|
||||
chmod -R u+rwX,g+rwX,o+X "/home/$user/shared"
|
||||
chmod g+s "/home/$user/shared"
|
||||
chmod -R u+rwX,g-rwX,o-rwX "/home/$user/private"
|
||||
if [[ -e "/home/$user/.shared.is.listed" ]]; then
|
||||
ln -sfT "/home/$user/shared" "/shared/$user"
|
||||
else
|
||||
echo "rename this file to '.shared.is.listed' to display shared folder in ~/public/" > "/home/$user/.shared.is.not.listed"
|
||||
rm -f "/shared/$user"
|
||||
fi
|
||||
chmod 0600 "$file"
|
||||
chown $USR "$file"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user