Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lchgrp(3) [php man page]

LCHGRP(3)								 1								 LCHGRP(3)

lchgrp - Changes group ownership of symlink

SYNOPSIS
bool lchgrp (string $filename, mixed $group) DESCRIPTION
Attempts to change the group of the symlink $filename to $group. Only the superuser may change the group of a symlink arbitrarily; other users may change the group of a symlink to any group of which that user is a member. PARAMETERS
o $filename - Path to the symlink. o $group - The group specified by name or number. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Changing the group of a symbolic link <?php $target = 'output.php'; $link = 'output.html'; symlink($target, $link); lchgrp($link, 8); ?> NOTES
Note This function will not work on remote files as the file to be examined must be accessible via the server's filesystem. Note When safe mode is enabled, PHP checks whether the files or directories being operated upon have the same UID (owner) as the script that is being executed. Note This function is not implemented on Windows platforms. SEE ALSO
chgrp(3), lchown(3), chown(3), chmod(3). PHP Documentation Group LCHGRP(3)

Check Out this Related Man Page

CHOWN(3)								 1								  CHOWN(3)

chown - Changes file owner

SYNOPSIS
bool chown (string $filename, mixed $user) DESCRIPTION
Attempts to change the owner of the file $filename to user $user. Only the superuser may change the owner of a file. PARAMETERS
o $filename - Path to the file. o $user - A user name or number. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Simple chown(3) usage <?php // File name and username to use $file_name= "foo.php"; $path = "/home/sites/php.net/public_html/sandbox/" . $file_name ; $user_name = "root"; // Set the user chown($path, $user_name); // Check the result $stat = stat($path); print_r(posix_getpwuid($stat['uid'])); ?> The above example will output something similar to: Array ( [name] => root [passwd] => x [uid] => 0 [gid] => 0 [gecos] => root [dir] => /root [shell] => /bin/bash ) NOTES
Note This function will not work on remote files as the file to be examined must be accessible via the server's filesystem. Note When safe mode is enabled, PHP checks whether the files or directories being operated upon have the same UID (owner) as the script that is being executed. SEE ALSO
chmod(3), chgrp(3). PHP Documentation Group CHOWN(3)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Changing the Effective Group ID

Here is my situation. On a RedHat 7.3 box, I have a user named jody. When I log in with jody and type in "id", I get the expected output: uid=1(jody) gid=1(jody) groups=1(jody), 510(test) However, I cannot figure which "id" option allows me to change the effective gid. I tried the options... (2 Replies)
Discussion started by: Jody
2 Replies

2. UNIX for Dummies Questions & Answers

group by in files :-)

My file looks like: X^~^12^d X^~^19^d Y^~^5^d Y^~^10^d Y^~^11^d Z^~^14^d I need a script that will "group by" the first field and Concatenate the values. My output should be: X^~^12,19^d Y^~^5,10,11^d Z^~^14~d Does anyone have any idea ? (10 Replies)
Discussion started by: hellsd
10 Replies

3. AIX

Changing name of most recent file

I need to change the name of a file within a script. For example I have two files. The first named scrnslc_0001 and the second scrnslc_0002. I want to change the name of the second to scrnslc_out. The appended number will change, and I won't know the file name in advance. If there were only one... (1 Reply)
Discussion started by: warpmail
1 Replies

4. UNIX for Dummies Questions & Answers

extracting return of ls -l into variables

If I do "ls -l filename" in a script, it should return something like this: -rw-r--r-- 1 user group 5945 Feb 28 14:24 filename How do I put each of the above strings into a different variable? eg Permissions, username, groupname, date (7 Replies)
Discussion started by: Sniper Pixie
7 Replies

5. Post Here to Contact Site Administrators and Moderators

UNIX Forums Users Group - LinkedIn ?

I received an email claiming to invite me to some sort of user group connected through this forum. I did not click the link because the email is of dubious appearance. Is this group legit and is there other information about it someplace? Thank you. (4 Replies)
Discussion started by: Bobby
4 Replies

6. UNIX for Dummies Questions & Answers

How can I better group my output?

I have a script that puts out a list that looks like this: bb1 newyork bb1 pittsburg bb2 seattle bb2 spokane sl1 sacramento I want to seperate the output so that it instead has a space between each group so like this: bb1 newyork bb1 pittsburg bb2 seattle bb2 spokane sl1... (8 Replies)
Discussion started by: llsmr777
8 Replies

7. UNIX for Dummies Questions & Answers

regarding changing ownership and group

i am able to change the mode using chmod and able to change permission. but i am not able to change group and ownership. getting as invalid can any one help me regarding this . (4 Replies)
Discussion started by: satheeshkr_cse
4 Replies

8. UNIX for Advanced & Expert Users

Getting real path to directory

Hi friends, Need your help. The question is: 1) We have directory '/SomeDirectory/SubDirectory' 2) And have symlink pointing to it like '/AnotherOneDirectory/symlink' '/AnotherOneDirectory/symlink' -> '/SomeDirectory/SubDirectory' 3) Need to get real path without symlinks knowing only... (7 Replies)
Discussion started by: kandrewo
7 Replies

9. Shell Programming and Scripting

File count for symlink using find command

Hi Guys, The script which I am using works really good for finding the file count for files that are not symlink. I know I can use find command like: find . -type l | wc -l This way I can get filecount of the symlink but is there a one liner to use -type l and -type f option ? That is... (4 Replies)
Discussion started by: dixits
4 Replies

10. Red Hat

how to hide the path users on the symlink.

Hello, can someone please suggest or is it possible to hide the path for the link from viewing it from remote users. for examples. as root user login #ls -l lrwxrwxrwx 1 root root 43 Oct 2 16:05 sftpdata -> /data/sftphome/sftpuser1/sftpdata/ #pwd /home/user1 # when user1 logs... (4 Replies)
Discussion started by: bobby320
4 Replies

11. Ubuntu

Creating conditional symlink

Hi All, Is there any way to create a symlink that will point to last 1000 line of a log file. My symlink will always point to "tail -1000 logfile". This can be achieved by writing a script and scheduling with high frequency, but I am looking for some other alternatives. Please let me know... (8 Replies)
Discussion started by: sussus2326
8 Replies

12. UNIX for Advanced & Expert Users

Permissions on a directory in /home for all users

Hi, I have created a shared directory on /home, where all users on a certain group have read, write and execute permissions. I did this using chmod -R g+rwx /home/shared/ The problem is, when a particular user creates a directory within /home/shared, other users are not able to write to... (8 Replies)
Discussion started by: lost.identity
8 Replies

13. UNIX for Dummies Questions & Answers

Remove symlink and target

i would like to remove a directory and also symlink target inside. my_directory -- file1 -> /targetpath/file1 -- file2 -> /targetpath/file2 rm -rf my_directory will not remove symlink target. rm -rf "`readlink -f file1`" will only remove target if specifying the symlink is specified ... (4 Replies)
Discussion started by: lsy
4 Replies

14. UNIX for Beginners Questions & Answers

Symlink

I know how to create a symlink but I am getting an error message that the file already exists. Also, my symlink doesn't point from target directory to the path correctly, Here is an example of the path to my folder structure path: cd /wkspce/wff/DEV/jobs/DEL the folder structure is: ... (3 Replies)
Discussion started by: dellanicholson
3 Replies

15. Shell Programming and Scripting

How to create symlink for latest file only?

Hello, On Solaris 10, here are entries for logs in httpd.conf ErrorLog "|/export/apache/apache-2.2.17/bin/rotatelogs -l -f /var/log/apache/error_log.%Y%m%d 86400" It keeps creating daily logs with below names - -rw-r--r-- 1 root root 1016747232 Apr 5 23:59... (16 Replies)
Discussion started by: solaris_1977
16 Replies