I do sudo cat /tmp/1 > /etc/udev/rules.d/69-libmtp.rules
but I get
bash: /etc/udev/rules.d/69-libmtp.rules: Permission denied
System: Ubuntu 16.04
Linux kernel: 4.6
I do sudo cat /tmp/1 > /etc/udev/rules.d/69-libmtp.rules
but I get
bash: /etc/udev/rules.d/69-libmtp.rules: Permission denied
System: Ubuntu 16.04
Linux kernel: 4.6
Redirections are set up by the current shell, so sudo
has no effect on your ability to write in /etc/udev/rules.d
.
The usual trick for this is to use tee
:
sudo tee /etc/udev/rules.d/69-libmtp.rules < /tmp/1
As pointed out by infixed though, in this particular case you don't need a redirection:
sudo cp /tmp/1 /etc/udev/rules.d/69-libmtp.rules
tee
outputs to the file given as its parameter, and to standard output. You can redirect the output to/dev/null
if you don't want to see it! – Stephen Kitt Jun 14 '16 at 20:07