To set the specified sshd log file in ssh server pc this way.
vim /etc/rsyslog.conf
local0.* /var/log/sshd.log
vim /etc/ssh/sshd_config
SyslogFacility local0
To create the log file:
touch /var/log/sshd.log
To restart all services.
systemctl restart rsyslog
systemctl restart sshd
To get all the ssh log in ssh client pc this way.
sudo vim /etc/bash.bashrc
HISTTIMEFORMAT="%Y-%m-%d:%H-%M-%S:whoami: "
export HISTTIMEFORMAT
PROMPT_COMMAND='history -a'
source /etc/bash.bashrc
Now to get all ssh log record.
history |grep ssh
My question is that how to set the specified ssh log file in ssh client pc,instead of sshd log file in ssh server pc?
Here is my try in ssh client pc.
vim /etc/rsyslog.conf
local0.* /var/log/ssh.log
vim /etc/ssh/ssh_config
SyslogFacility local0
To create the log file:
touch /var/log/ssh.log
To restart all services.
systemctl restart rsyslog
reboot
An error occur when to login my vps from ssh client pc:
/etc/ssh/ssh_config: line 56: Bad configuration option: syslogfacility
/etc/ssh/ssh_config: terminating, 1 bad configuration options
Is there a way to set the specified ssh log file in ssh client pc instead of logging it in history?
History command can log all the ssh action taken in my ssh client pc,i want all the log info in a single specified file such as /var/log/ssh.log.
Please don't tell me this way.
history |grep ssh >> /var/log/ssh.log