UNIX command to display Owner,Group,Root and Subdirectories list
Hi Team,
Am a newbie to Unix. As I would like to see the Server Name,Owner Name ( not numeric form), Group Name ( not numeric ID), ROOT path.
I would like to send this list as an attachment to my personal mail. Can any one please help me out to to resolve this .
Here is the sample result which am expecting
Thanks,
Vasuv
---------- Post updated at 08:29 PM ---------- Previous update was at 07:56 PM ----------
using this commad am able to see the list but unable to copy the entire list. Can any one advise how to coy the entire list and how can I this copies to list to my mail.
Please advise.
Last edited by Scrutinizer; 03-19-2016 at 01:46 PM..
Reason: Additional code tags
:confused:
ls -dlRr
I've tried different combinations of the ls command using the above-mentioned options but none of them are giving me the output I am looking for.
Objective: To get a recursive listing of all subdirectories from a particular starting point. For example, if my starting... (5 Replies)
hi all,
i need to capture all the files in a directory and its subdirectories that have owner name different than the root owner.
for one file it is " stat -c %U filename " but i need to search for each and every file and record it.
thanks in advance (14 Replies)
Hi all,
We have some files are under 744 permissions and the the owner is say owner1 and group1.
Now we have another user owner2 of group2, owner2 can remove files of the owner1 and the permission of those files are 744, unix admin told us he did some config at his side so we can do that.
... (14 Replies)
hai,
I am new to Unix, I have a requirement to display owner name , directory or sub directory name, who's owner name is not equal to "oasitqtc".
(here "oasitqtc" is the owner of the directory or sub directory.)
i have a command (below) which will display all folders and sub folders, but i... (6 Replies)
The a chown was done and instead of using ./ a / was used and root ownership files got changed.
I need to change the ownership of the files/directory back - backups are not working and I am concerned a reboot will not be successful.
Can anyone provide the ownership of these files/directories... (6 Replies)
Hi,
I'm the root user on my computer, but I'm writing a script that does a lot of file handling. Every time I create a file or directory it automatically requires root privileges. Is there a way I can just create a file that the user can access without a password?
For example in my script I... (20 Replies)
I have a folder named test/ and under that I have multiple directories and in each of the directory I have multiple log files. I want to know how many files exists under each sub directory.
test
|--quanrantine
|--logfile1
|--logfile2
|--spooling
|--logfile1
... (4 Replies)
If I have to identify the group owner of an AIX group, what is the command to be used. Example: there is an mqadm group, how do I find the owner of this group?
Please help. (6 Replies)
I want to add a condition is my find command to include files/sub-directory whose owner or group is all numeric number.
My current find command is
find . \( -user root -o -user soham\) -type f -exec ls -l {} \; 2>&1
---------- Post updated at 10:20 AM ---------- Previous update was at... (5 Replies)
Discussion started by: Soham
5 Replies
LEARN ABOUT LINUX
fchown
FCHOWN(P) POSIX Programmer's Manual FCHOWN(P)
NAME
fchown - change owner and group of a file
SYNOPSIS
#include <unistd.h>
int fchown(int fildes, uid_t owner, gid_t group);
DESCRIPTION
The fchown() function shall be equivalent to chown() except that the file whose owner and group are changed is specified by the file
descriptor fildes.
RETURN VALUE
Upon successful completion, fchown() shall return 0. Otherwise, it shall return -1 and set errno to indicate the error.
ERRORS
The fchown() function shall fail if:
EBADF The fildes argument is not an open file descriptor.
EPERM The effective user ID does not match the owner of the file or the process does not have appropriate privilege and
_POSIX_CHOWN_RESTRICTED indicates that such privilege is required.
EROFS The file referred to by fildes resides on a read-only file system.
The fchown() function may fail if:
EINVAL The owner or group ID is not a value supported by the implementation. The fildes argument refers to a pipe or socket or an fat-
tach()-ed STREAM and the implementation disallows execution of fchown() on a pipe.
EIO A physical I/O error has occurred.
EINTR The fchown() function was interrupted by a signal which was caught.
The following sections are informative.
EXAMPLES
Changing the Current Owner of a File
The following example shows how to change the owner of a file named /home/cnd/mod1 to "jones" and the group to "cnd".
The numeric value for the user ID is obtained by extracting the user ID from the user database entry associated with "jones". Similarly,
the numeric value for the group ID is obtained by extracting the group ID from the group database entry associated with "cnd". This example
assumes the calling program has appropriate privileges.
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <pwd.h>
#include <grp.h>
struct passwd *pwd;
struct group *grp;
int fildes;
...
fildes = open("/home/cnd/mod1", O_RDWR);
pwd = getpwnam("jones");
grp = getgrnam("cnd");
fchown(fildes, pwd->pw_uid, grp->gr_gid);
APPLICATION USAGE
None.
RATIONALE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
chown() , the Base Definitions volume of IEEE Std 1003.1-2001, <unistd.h>
COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol-
ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE
and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained
online at http://www.opengroup.org/unix/online.html .
IEEE /The Open Group 2003 FCHOWN(P)