ssh 登陆之后,自动执行命令或者执行一段脚本

将命令放入 远程用户家目录下的.bashrc里边。如下:

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions

sudo su  # 这个就是要执行的命令,省的以后自己登陆后总是需要执行这个
posted @ 2021-09-13 11:11  Star-Hitian  阅读(1436)  评论(0编辑  收藏  举报