You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To protect a certain directory when allowing others to SSH to your laptop, you can use file permissions to restrict access to that directory.
Here are the steps to follow:
Create a new user account for the person you want to allow SSH access to your laptop. You can do this by running the following command in your terminal:
sudo adduser <username>
Switch to the new user account by running the following command:
su <username>
Create a new directory for the person to access, and change its ownership to the new user account:
Change the permissions of the directory to allow only the owner to read, write, and execute:
chmod 700 <directory>
Edit the SSH server configuration file (/etc/ssh/sshd_config) to allow the new user account to SSH into your laptop. Add the following line to the end of the file:
AllowUsers <username>
Restart the SSH service to apply the changes:
sudo service ssh restart
Now, when the person you have allowed to SSH into your laptop logs in, they will only have access to the specified directory and will not be able to access any other parts of your system.
The text was updated successfully, but these errors were encountered:
To restrict a Linux account to only allowed commands (scp, sftp, rsync) and disallow ssh access, you can follow these steps:
Create a new group for the restricted account: sudo groupadd restricted_group
Add the restricted user to the new group: sudo usermod -a -G restricted_group restricted_user
Create a new shell script in the restricted user's home directory:
sudo nano /home/restricted_user/restricted_shell.sh
In the script, add the following lines:
#!/bin/bash
case "$1" in
scp|sftp|rsync)
$1 $2 $3 $4 $5
;;
*)
echo "This account is restricted to only scp, sftp and rsync commands"
exit 1
;;
esac
Save and close the file.
Make the script executable:
sudo chmod +x /home/restricted_user/restricted_shell.sh
Change the restricted user's shell to the new script:
sudo usermod -s /home/restricted_user/restricted_shell.sh restricted_user
Test the restricted account by trying to log in via SSH. SSH access should be disallowed and only scp, sftp, and rsync commands should be allowed.
Note: It's important to thoroughly test the restricted account to ensure that it meets your security requirements.
the certs etc. could also provide the files as docker volume in a separate (non-priviledged) docker container running openssh server (e.g. for the tailscale docker images this is already included). It has some other benefits of healthchecks, automated restart (autohealing) if wanted etc.
To protect a certain directory when allowing others to SSH to your laptop, you can use file permissions to restrict access to that directory.
Here are the steps to follow:
Create a new user account for the person you want to allow SSH access to your laptop. You can do this by running the following command in your terminal:
Switch to the new user account by running the following command:
Create a new directory for the person to access, and change its ownership to the new user account:
Change the permissions of the directory to allow only the owner to read, write, and execute:
Edit the SSH server configuration file (/etc/ssh/sshd_config) to allow the new user account to SSH into your laptop. Add the following line to the end of the file:
Restart the SSH service to apply the changes:
Now, when the person you have allowed to SSH into your laptop logs in, they will only have access to the specified directory and will not be able to access any other parts of your system.
The text was updated successfully, but these errors were encountered: