通过ssh登录服务器后自动执行命令

本文最后更新于:2022年6月1日 下午

例如有一台虚拟机无法更改主机名,直接把更改主机名命令写道这里

1
# cd ~/ && vim .bash_profile

文件下面添加命令(👇整个文件的代码)

1
2
3
4
5
6
7
8
9
10
11
12
13
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
hostnamectl set-hostname --static test

通过ssh登录服务器后自动执行命令
https://simple2ich4n.top/32185/
作者
2ich4n
发布于
2021年7月16日
更新于
2022年6月1日
许可协议