Перейти к содержимому

Отключить открытый ssh-сервер без прав администратора

0

Есть ли способ остановить ssh-сервер без повышения прав root? Или просто не позволяйте другим подключаться к моему компьютеру.

235 просмотров
bemug спросил 11 лет назад
B 198

2 ответа

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 ответил 11 лет назад
C 121
2

@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 
Josh Whetton ответил 11 лет назад
J 63