大网数据广告活动
服务器运维问答

unique stamp per SSH login

· 52CE 我爱测

We have several employees who log into a virtual machine (OS 6/7) using the same user: root (it needs to be this way for various reasons). Is there anyway to add the user's hostname/user's name to the login session, in order to s…

问题原文

原帖链接 · Erdel · CC BY-SA 3.0

We have several employees who log into a virtual machine (OS 6/7) using the same user: root (it needs to be this way for various reasons).

Is there anyway to add the user's hostname/user's name to the login session, in order to see who did what and when?

已采纳解答

原帖链接 · andol · CC BY-SA 3.0

First of all I agree with Slipeer about individual accounts really is the preferred solution. Yet, we do live in an imperfect world, and sometimes one is not in a position to implement the Right solution right away.

The most reliable option to identify different people using the same account is to look at the ssh key used to login. If you are using a recent enough OpenSSH that information will be provided by the default INFO LogLevel.

sshd[2425]: Accepted publickey for vagrant from 10.0.2.2 port 54576 ssh2: RSA SHA256:5cH1LgeZ+m/OuxpPeFc9bIql3pMaQl/mtym0mGmecNc

In case of an older OpenSSH that information is only available by way of the VERBOSE LogLevel.

sshd[2023]: Found matching RSA key: 3b:7f:2d:8f:3a:82:ae:69:02:4f:00:2c:71:5e:e0:6a
sshd[2023]: Accepted publickey for vagrant from 10.0.2.2 port 36164 ssh2

And yes, having a record of the ssh key used for login is also a good thing when it comes to individual accounts.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-27)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。