当我以非 root 用户身份使用 plink 连接到我的 Debian 机器时,我总是收到“RTNETLINK 答案:操作不允许”。操作成功了,所以我甚至不知道什么地方出了问题。
例如
PS> plink -no-antispoof -i $adminKey admin@$ip 'echo ok'
RTNETLINK answers: Operation not permitted
ok
与“root”相同的操作不会返回任何错误:
PS> plink -no-antispoof -i $rootKey root@$ip 'echo ok'
ok
详细输出:
PS> plink -v -no-antispoof -i $adminKey_ppk admin@$ip 'echo ok'
Looking up host "***" for SSH connection
Connecting to *** port 22
Connected to ***
We claim version: SSH-2.0-PuTTY_Release_0.79
Remote version: SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u1
Using SSH protocol version 2
No GSSAPI security context available
Doing NTRU Prime / Curve25519 hybrid key exchange, using hash SHA-512 (unaccelerated)
Server also has ecdsa-sha2-nistp256/rsa-sha2-512/rsa-sha2-256/ssh-rsa host keys, but we don't know any of them
Host key fingerprint is:
ssh-ed25519 255 SHA256:Vex4eZZe6x1BGG32zdplJsdiubeeLoqhG7JRzekW+0M
Initialised AES-256 SDCTR (AES-NI accelerated) outbound encryption
Initialised HMAC-SHA-256 (unaccelerated) outbound MAC algorithm
Initialised AES-256 SDCTR (AES-NI accelerated) inbound encryption
Initialised HMAC-SHA-256 (unaccelerated) inbound MAC algorithm
Reading key file "***"
Using username "admin".
Offered public key
Offer of public key accepted
ASent public key signature
uthenticating with public key "***"
Access granted
Opening main session channel
Remote debug message: ***: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
Remote debug message: ***: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
Opened main channel
Started a shell/command
RTNETLINK answers: Operation not permitted
oSession sent command exit status 0
k