Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-16-2006, 05:33 AM
|
#1
|
LQ Newbie
Registered: Aug 2004
Posts: 10
Rep:
|
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.
|
|
|
02-16-2006, 05:51 AM
|
#2
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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.)
|
|
|
02-16-2006, 07:53 AM
|
#3
|
LQ Newbie
Registered: Aug 2004
Posts: 10
Original Poster
Rep:
|
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]#
|
|
|
02-16-2006, 10:19 AM
|
#4
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
|
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.
|
|
|
02-20-2006, 08:58 AM
|
#5
|
Senior Member
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873
|
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.
|
|
|
All times are GMT -5. The time now is 03:07 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|