Sponsored Content
Full Discussion: determine owner of a file
Top Forums Shell Programming and Scripting determine owner of a file Post 302161860 by fpmurphy on Saturday 26th of January 2008 01:39:25 PM
Old 01-26-2008
Using Perl

Code:
use File::stat;
use User::pwent;

$filename = "$ARGV[0]";
$attrs = stat($filename);
$pwattrs = getpwuid($attrs->uid);

printf "Owner is %s (%d)\n", $pwattrs->name, $attrs->uid;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

determine owner directory permissions from within the directory

From within a directory, how do I determine whether I have write permission for it. test -w pwd ; echo ? This doesn't work as it returns false, even though I have write permission. (4 Replies)
Discussion started by: Sniper Pixie
4 Replies

2. UNIX for Dummies Questions & Answers

How to change the owner of the file?

How to change the owner of the file? Can I change the owner of file/ files? I am user and not admin.(not logged as root) (1 Reply)
Discussion started by: redlotus72
1 Replies

3. UNIX for Dummies Questions & Answers

change owner of a file

im running into changing the ownership of a file. I am trying to change the ownership to "system", but it doesn't want to work. I sudo chown system /preferences.plist Password: chown: system: Invalid argument is there a way to read the ownership of a file, something like read chown... (3 Replies)
Discussion started by: CBarraford
3 Replies

4. Solaris

Owner of file gets 'not owner' error for chgrp

Hi Folks, I know that changing users and groups is pretty basic admin, but this one has got me stumped. When I try to change the group of a file for which I am the owner for, it still gives me a 'Not owner' error. For example, when I am logged in as 'webadmin', I have the following file: ... (4 Replies)
Discussion started by: brizrobbo
4 Replies

5. UNIX for Advanced & Expert Users

Is there a command to get the owner of a file?

At the moment I'm just using `ls -o` (with `cut`), but `ls` is obviously giving me a lot more output than just the file owner. (9 Replies)
Discussion started by: Bilge
9 Replies

6. Shell Programming and Scripting

getting file owner in perl

hi, how can I get the owner of the file ( not uid) on windows plaform. "getpwuid" is not working on windows. I knw it works on unix. Thanks. (2 Replies)
Discussion started by: shellwell
2 Replies

7. Shell Programming and Scripting

How to Determine the file owner's username

I've read the following post here and I get no output from the command. I've tried changing the '$3' to $5, 7, 10...and still nothing. Ultimately what I'd like to is determine who owns the file and rename it to file_name_$USERNAME. $ uname -a SunOS sun001 5.10 Generic_118833-33 sun4u sparc... (3 Replies)
Discussion started by: nadeemsm
3 Replies

8. UNIX for Advanced & Expert Users

How UNIX admin set up this? how files of 744 of other owner can be removed by another owner?

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)
Discussion started by: TheGunMan
14 Replies

9. Cybersecurity

Change file owner

What i did: - logged in with acc1 and created a new user acc2 commands used: useradd and passwd. - Then i logged in acc2. but all the files are owned by acc1. Issue: I try to change the owner of the files using chown command . But it gives me a error message. All i want to do is... (13 Replies)
Discussion started by: TotallyConfused
13 Replies

10. Solaris

Privileges : modify dir/file owner by other that's not owner

i need to do the following operations in solaris 10: 1.change owner and group owner for files which are not owned by the current user and user group 2.to can delete files in the /tmp directory which are not of the current user 3. allow to a standard user the deletion of files in the /tmp... (1 Reply)
Discussion started by: sirmark
1 Replies
LDAP_ADD(3)						     Library Functions Manual						       LDAP_ADD(3)

NAME
ldap_add, ldap_add_s - Perform an LDAP add operation SYNOPSIS
#include <ldap.h> int ldap_add(ld, dn, attrs) LDAP *ld; char *dn; LDAPMod *attrs[]; int ldap_add_s(ld, dn, attrs) LDAP *ld; char *dn; LDAPMod *attrs[]; DESCRIPTION
The ldap_add_s() routine is used to perform an LDAP add operation. It takes dn, the DN of the entry to add, and attrs, a null-terminated array of the entry's attributes. The LDAPMod structure is used to represent attributes, with the mod_type and mod_values fields being used as described under ldap_modify(3), and the ldap_op field being used only if you need to specify the LDAP_MOD_BVALUES option. Otherwise, it should be set to zero. Note that all entries except that specified by the last component in the given DN must already exist. ldap_add_s() returns an LDAP error code indicating success or failure of the operation. See ldap_error(3) for more details. The ldap_add() routine works just like ldap_add_s(), but it is asynchronous. It returns the message id of the request it initiated. The result of this operation can be obtained by calling ldap_result(3). ERRORS
ldap_add() returns -1 in case of error initiating the request, and will set the ld_errno field in the ld parameter to indicate the error. ldap_add_s() will return an LDAP error code directly (LDAP_SUCCESS if everything went ok, some error otherwise). SEE ALSO
ldap(3), ldap_modify(3) ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). OpenLDAP is derived from University of Michigan LDAP 3.3 Release. OpenLDAP 2.0.27-Release 22 September 1998 LDAP_ADD(3)
All times are GMT -4. The time now is 04:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy