본문 바로가기
Development Solutions/Linux

How to fix when redirect (>) doesn't work because you don't have permission in Ubuntu (우분투에서 권한이 없다는 이유로 리다이렉션(>)이 안될 때 해결 방법)

by Dev Diary Hub 2022. 10. 13.
반응형

How to fix when redirect (>) doesn't work because you don't have permission in Ubuntu

(우분투에서 권한이 없다는 이유로 리다이렉션(>)이 안될 때 해결 방법)

 

 

아래처럼 명령어를 내리면 /etc/udev/rules.d 내의 파일에 리다이렉션이 실패한다.

이유는 폴더가 root권한의 폴더이므로 일반 유저에겐 권한이 없기 때문이다.

[English](If you issue the command as below, redirection to the file in /etc/udev/rules.d fails.
The reason is that the folder is a folder with root privileges, so normal users do not have privileges.)

 

echo "test text" > /etc/udev/rules.d/51-usb-devices.rules

 

 

해결 방법은 이렇다. (Here's how to solve it:)

 

1. 루트 계정으로 전환한다. (Switch to the root account.)

sudo -i

2. 이전에 실패했던 리다이렉션 명령을 수행한다. 아마 성공할 것이다. (Executes a redirection command that previously failed. You will probably succeed.)

echo "test text" > /etc/udev/rules.d/51-usb-devices.rules

3. 루트 계정에서 로그아웃한다. (Log out of the root account.)

exit
반응형