LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-16-2006, 05:33 AM   #1
eswanepoel
LQ Newbie
 
Registered: Aug 2004
Posts: 10

Rep: Reputation: 0
fuser -u filename.dat


We upgraded from Solarise9 to Red Hat 9. In Unix I used the command fuser -u filename.dat to see what user is holding a file. It showed the user and his ID
Jon (1234) Jon (5678)
In Linux the same command is used fuser -u filename.date,
but it shows all the files is being holded by root
root(1234) root(56789). I also tried to use lsof, but this also does not show the user.
 
Old 02-16-2006, 05:51 AM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Try ls -l <filename>.

Your fuser command is (or was) probably just an alias for this, since fuser is more commonly a command for mounting a file system in "user space,"

If your upgraded your system, perhaps the "real" fuser system was installed, and your fuser command mounted the data file as a file system. (I believe that it is possible to mount some types of files, e.g. iso and archive, as file systems using fuser.)
 
Old 02-16-2006, 07:53 AM   #3
eswanepoel
LQ Newbie
 
Registered: Aug 2004
Posts: 10

Original Poster
Rep: Reputation: 0
fuser -u filename.dat

ls -l does not do what fuser -u filename did on my Unix server
Here is a example of what it looked like in Unix

APPX, Copyright (c) 1990-2004, APPX Software, Inc.
All Rights Reserved.


[ssc@appexsrv1 ssc]$ su - rooot
Password: [ssc@appexsrv1 ssc]$ su - root
Password:
[root@appexsrv1 root]# cd /usr/local/appxdata/DIV/ACC/Data
[root@appexsrv1 Data]# ls -l NEWVOTE.dat
-rw-r--r-- 1 appx appx 16393585 Feb 16 14:40 NEWVOTE.dat
[root@appexsrv1 Data]# fuser -u NEWVOTE.dat
NEWVOTE.dat: 3608(Jon) 3761(Jon)
[root@appexsrv1 Data]#

In Linux

[ssc@appexsrv1 ssc]$ su - root
Password:
[root@appexsrv1 root]# cd /usr/local/appxdata/DIV/ACC/Data
[root@appexsrv1 Data]# ls -l NEWVOTE.dat
-rw-r--r-- 1 appx appx 16393585 Feb 16 14:40 NEWVOTE.dat
[root@appexsrv1 Data]#


[ssc@appexsrv1 ssc]$ su - root
Password:
[root@appexsrv1 root]# cd /usr/local/appxdata/DIV/ACC/Data
[root@appexsrv1 Data]# ls -l NEWVOTE.dat
-rw-r--r-- 1 appx appx 16393585 Feb 16 14:40 NEWVOTE.dat
[root@appexsrv1 Data]# fuser -u NEWVOTE.dat
NEWVOTE.dat: 3608(root) 3761(root)
[root@appexsrv1 Data]#
 
Old 02-16-2006, 10:19 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Perhaps you could obtain the functionality you want with 'lsof'.

/usr/sbin/lsof | grep userid | grep filename

eg:

/usr/sbin/lsof | grep bomr | grep /bin/bash

This could be turned into a bash function or shell script, to allow passing the required arguments. The output could be cleaned up to suit your taste with filters such as 'sed'.

--- rod.


ps. My original interest in this thread was to do with the 'filesystem-in-userspace' fuse. You might consider the implications of using the name 'fuser' with any possible future conflicts.
 
Old 02-20-2006, 08:58 AM   #5
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
fuser works fine for me in the way that you say that you want. I suspect that the root account really is the user id that has that file open. Try using fuser on a home directory of an account that is logged in (not root). I bet it will properly show the user account id.

Example: log on as Jon. Then as either Jon or root do fuser -u on the home directory of Jon. If Jon's home directory is /home/Jon then do this:

fuser -u /home/Jon

Last edited by stress_junkie; 02-20-2006 at 09:01 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Fuser command Gins Linux - General 3 08-09-2005 01:15 PM
change uploaded files from filename.avi to filename.avi.html like www.rapidshare.de latheesan Linux - Newbie 3 06-16-2005 04:33 AM
filename- and filename~ files? slinky2004 Linux - Newbie 5 10-17-2004 10:32 PM
lsof and fuser do not work with /dev/dsp alexrait1 Slackware 4 10-09-2004 04:07 PM
fuser problem linuxxunil Debian 4 09-14-2004 11:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:07 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