본문 바로가기
Linux/shell script

[Linux] sed명령어를 이용해서 shell script로 password 변경하는 법

by onda.cloud 2022. 4. 4.
cent 환경으로 password 변경하는 법
sed -i "s|#PasswordAuthentication no|PasswordAuthentication yes|g" /etc/ssh/sshd_config
systemctl restart sshd
echo '<비밀번호>' | passwd --stdin ec2-user

 

ubuntu 환경으로 password 변경하는 법
sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config
systemctl restart sshd
echo '<ubuntu:비밀번호>' | chpasswd

'Linux > shell script' 카테고리의 다른 글

[Linux] shell script for문 정리  (0) 2022.06.12
[Linux] shell script if문 정리  (0) 2022.06.11

댓글