LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-22-2008, 07:46 PM   #1
kr0m3
LQ Newbie
 
Registered: Feb 2006
Location: 010101010101001101000001
Distribution: slackware
Posts: 7

Rep: Reputation: 0
Question tshark gives "permission denied" writing to (any) file in home dir.


greetz~

first, the proper introduction:
Ubuntu Hardy Heron system
with the following tshark install:

Code:
user@host:~/Forensics$ tshark -vv
TShark 1.0.0

...<snip> ...

Compiled with GLib 2.16.1, with libpcap 0.9.8, with libz 1.2.3.3, with POSIX
capabilities (Linux), with libpcre 7.4, without SMI, with ADNS, with Lua 5.1,
with GnuTLS 2.0.4, with Gcrypt 1.2.4, with MIT Kerberos.

Running on Linux 2.6.24-19-generic, with libpcap version 0.9.8.

Built using gcc 4.2.3 (Ubuntu 4.2.3-2ubuntu7).
ok, now then;

Code:
user@hostname:~/Forensics$ sudo tshark -n -i wlan0 -s 1514 -w capfile.lpc
gives...

Code:
Running as user "root" and group "root". This could be dangerous.
Capturing on wlan0
tshark: The file to which the capture would be saved ("/home/user/capfile.lpc") could not be opened: Permission denied.
and even this;

Code:
user@hostname:~# sudo -i
root@hostname:~# tshark -n -i wlan0 -s 1514 -w /home/user/~Forensics/capfile.lpc
gives same.

however, if I specify file outside of my homedir, it functions correctly as either root or with 'sudo'

Code:
root@hostname:~# mount
/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.24-19-generic/volatile type tmpfs (rw)
securityfs on /sys/kernel/security type securityfs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/user/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=user)
as i get this error writing to any location in the homedir, there is little (read: "no") chance that standard file/dir perms are the issue.

i have gone so far as to 'touch' the destination file first, still receive error.

i'm suspecting 'nosuid' as the culprit but this doesn't really jive with me. before I start tearing things down to t-shoot this i was wondering if anyone had any interesting input here.

thanks in advance;
~k

Last edited by kr0m3; 06-22-2008 at 08:39 PM. Reason: more info...
 
Old 06-23-2008, 04:00 AM   #2
storkus
Member
 
Registered: Jun 2008
Location: Phoenix, Arizona, USA
Distribution: Slackware
Posts: 329

Rep: Reputation: 51
Wow, no wonder there haven't been any answers: that's a tough question! As root, you should *NEVER* receive permission errors unless you're doing something that really doesn't make sense, like running "more" on a directory or "ls" on a file.

"nosuid" could be a culprit; another possibility is a bug in that program. Since I've never used it, I can't help you there. If you
find something else about it, make sure to post about it.

Mike
 
Old 12-16-2009, 06:40 AM   #3
xcecco1
LQ Newbie
 
Registered: Dec 2009
Posts: 1

Rep: Reputation: 0
Re: tshark error : solution

I ave the same problem.
The solution seems to be this:
Change the owner of the directory whom you are writing the
output file as the same user running tshark, or dumpcap...
E.g.: if you are root, make sure (che) your working dir
(who tshark are creating the file(s)) is owned by root..

Excuse (tanto) my poor english
 
Old 04-15-2016, 05:24 AM   #4
BenEllerby
LQ Newbie
 
Registered: Apr 2016
Posts: 1

Rep: Reputation: Disabled
Lightbulb SOLUTION: chmod o=rw

Hi,

I had the same issue, very strange bug.

Anyway, fixed by creating the file and setting the permissions for others to read and write it.

Code:
touch test.log
chmod o=rw test.log
sudo tshark -i wlan0 -w test.log
First line to create file.
Second line to change permissions to allow 'others' to read or write.
Third line to run tshark to write to this file.

Hope that helps
Ben
 
Old 08-16-2016, 04:30 AM   #5
getgoodgrade
LQ Newbie
 
Registered: Aug 2016
Location: New York
Posts: 16

Rep: Reputation: 0
Thanks Ben, had the same issue that you had. Used your tips and they helped.
 
Old 08-16-2016, 11:22 AM   #6
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
That sounds like a typical problem that can pop up with programs not running as the user whose home directory you are reading/writing in.

IIRC the default permissions for the users home directory are 710 and the user and group name are the same so no one except the user and root are allowed to read/write anything in the users home directory or sub-directories (at least on Fedora).
I had a similar problem using plexmediaserver in that the media files were located in sub-directories under my users home directory and until I modified the home directory permissions to allow access for the plex user the server could not access any files.
Running "ls -l /home" shows the problem here. (My laptop is not modified from the default permissions.)
Quote:
[user@laptop ~]$ ls -l /home
total 36
drwx--x---+ 68 user user 4096 Aug 14 17:55 user
Although I could have added the plex server user to my users group with the same result, I chose to give others execute permissions on my home directory to fix my problem. The same command on my media server machine shows the fix I used.
Quote:
drwxr-x--x. 104 user user 4096 Aug 11 13:12 user
 
Old 10-08-2019, 06:45 AM   #7
sluge
Member
 
Registered: Dec 2006
Location: Russia,52
Posts: 128

Rep: Reputation: 6
My variant is to use

Code:
tshark -n -i wlan0 -s 1514 -w /tmp/capfile.lpc
 
  


Reply

Tags
error, permissions, tshark



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NFS problem: "Could not chdir to home directory /home/USER: Permission denied" sumanc Linux - Server 4 07-22-2010 04:12 PM
"Permission denied" and "recursive directory loop" when searching for string in files mack1e Linux - Newbie 5 06-12-2008 07:38 AM
Submount, "permission denied" when writing to floppy as normal user DaneM Linux - Software 5 02-22-2006 02:05 PM
What is this "?" File in my home dir? stardotstar Linux - Software 3 01-22-2006 03:57 PM
sendmail: "permission denied" when using include:/file sohmc Linux - Software 1 05-22-2003 06:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration