Synology DSM (Unix) - 无法与其他用户进行 SSH

Synology DSM (Unix) - 无法与其他用户进行 SSH

在我的 Synology(DSM 6.2.2-24922)上,我有 3 个用户:

  • admin(禁用 ssh 和登录)
  • user1(我的新管理员用户,由 Synology 推荐)
  • user2(非管理员)

我可以通过 连接 sshuser1但不能通过 连接user2

我进行了编辑/etc/passwd以替换/sbin/nologin

user1:x:1026:100:Administrator:/var/services/homes/user1:/bin/sh
user2:x:1035:100::/var/services/homes/user2:/bin/sh

我可以su从 user2user1及其ls主目录中:

sudo su - user2

但是 ssh 命令总是返回Permission denied

[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to my.domain.com ([123.123.123.123]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
Permission denied, please try again.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to my.domain.com closed.
Transferred: sent 2204, received 2744 bytes, in 0.1 seconds
Bytes per second: sent 23710.3, received 29519.5
debug1: Exit status 1

有什么线索吗?

答案1

要通过 登录ssh,用户必须属于“管理员”组。如果您/etc/ssh/sshd_config在 Synology 上查看,您将看到一行AllowGroups设置此限制。如果您将其放入user2administrators组,他们将能够使用 登录ssh。将用户放入该administrators组将自动将其 shell(其行中的最后一个字段/etc/passwd)从/sbin/no login更改为/bin/bash

我的 Synology sshd 配置允许第二组“ssh_users”,但我根本没有测试过这一点。

如果您尝试这样做,请注意,如果您在 DSM 中修改用户,对/etc/passwd和等文件中的用户属性的手动更改/etc/group通常会被撤消,有时如果您在 DSM 中进行了看似不相关的更改。有时升级也会撤消手动更改。

相关内容