Есть ли способ остановить ssh-сервер без повышения прав root? Или просто не позволяйте другим подключаться к моему компьютеру.
Отключить открытый ssh-сервер без прав администратора
2 ответа
There is no way (legitimate anyway) to do this without root elevation. If it is your computer why not just elevate to root and disable it there?
@Caraxian is correct about stopping ssh server.
You may limit the users/groups that have access to ssh. Without knowledge of your distro, I will demonstrate with a CentOS/RHEL configuration:
In /etc/ssh/sshd_config you can use the AllowUsers or AllowGroups directives to explicitly allow certain users/groups to ssh. One easy way to do this is to create an ssh group and add users to that group (group id in example can be any unused group ID).
# groupadd -g 2000 ssh # usermod -G johndoe ssh After adding the users to the ssh group, append AllowGroups ssh to /etc/ssh/sshd_config and restart sshd: /etc/init.d/sshd restart OR service sshd restart.
In the case where you don't want ssh to run at all on start-up:
# chkconfig sshd off