Permission denied on /dev/xvdf despite sudo?
Posted
by
Sid
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Sid
Published on 2011-11-30T22:38:36Z
Indexed on
2011/12/01
2:20 UTC
Read the original article
Hit count: 385
I'm trying to get a stream off port 9999 and write to /dev/xvdf. I'm using Amazon EC2 with the Ubuntu 11.10 server image. By default I log in as 'ubuntu' which has sudo privileges. However, when I run the following netcat command, I get this error
ubuntu@ip-10-252-35-122:~$ ls -al /dev/xv*
brw-rw---- 1 root disk 202, 1 2011-11-30 22:22 /dev/xvda1
brw-rw---- 1 root disk 202, 80 2011-11-30 22:27 /dev/xvdf
ubuntu@ip-10-252-35-122:~$ sudo netcat -p 9999 -l > /dev/xvdf
bash: /dev/xvdf: Permission denied
ubuntu@ip-10-252-35-122:~$
Any idea why I get the permission denied error and how I can work around it?
Update: Something mysterious is running in the background that resets the permissions? Check the snippet below and the permission flags seem to automatically reset when I try using /dev/xvdf !?!
ubuntu@ip-10-252-35-122:~$ sudo chmod 777 /dev/xvdf
ubuntu@ip-10-252-35-122:~$ ls -al /dev/xvdf
brwxrwxrwx 1 root disk 202, 80 2011-11-30 22:43 /dev/xvdf
ubuntu@ip-10-252-35-122:~$ sudo nc -p 9999 -l > /dev/xvdf
This is nc from the netcat-openbsd package. An alternative nc is available
in the netcat-traditional package.
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-P proxy_username] [-p source_port]
[-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]
[-x proxy_address[:port]] [hostname] [port[s]]
ubuntu@ip-10-252-35-122:~$ ls -al /dev/xvdf
brw-rw---- 1 root disk 202, 80 2011-11-30 22:43 /dev/xvdf
ubuntu@ip-10-252-35-122:~$
I'm using stock Ubuntu Amazon EC2 images from http://alestic.com/ (links to images at the top)
© Ask Ubuntu or respective owner