sudo -> super user do (permission)
시스템을 변경하거나 영향을 줄 수 있는 명령을 진행하려면 강력한 권한이 필요하다.
권한을 갖는 방법은 두 가지가 있다.
root user 로 접속하거나, sudo 명령어를 사용하는 것이다.
yum install 명령어로 git을 설치하려고 했지만 root 권한이 필요하다고 한다.
ec2-user:~/environment $ yum install git
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
You need to be root to perform this command.
sudo 명령어를 앞에 붙힌다면 권한이 부여되어 설치가 진행된다.
ec2-user:~/environment $ sudo yum install git
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
233 packages excluded due to repository priority protections
Package git-2.32.0-1.amzn2.0.1.x86_64 already installed and latest version
Nothing to do
그러나 sudo 명령어나 root user 는 강력한 권한이 있는 만큼 조심해야 한다.
실수로 위험한 명령어를 실행하게 되면 치명적인 피해를 입을 수 있다.
밑의 예시는 절대로 실행하면 안된다.
루트 디렉토리에 있는 모든 파일을 삭제하는 위험한 명령어.
rm -rf /
기존 Cloud9은 Ubuntu 를 기반으로 만들어졌기 때문에
apt-get install git
과 같이 apt-get을 사용할 수 있었다.
지금은 AWS에서 서비스되고 있기 때문에 Amazon Linux를 기반으로 실행된다.
따라서 apt-get 대신 yum 명령어를 사용해야 한다.
📕 만약 apt-get을 사용할 경우 command not found 오류가 뜨는 걸 볼 수 있다.
ec2-user:~/environment $ apt-get install git
bash: apt-get: command not found