Finds all files in /home owned by UID 1056 and changes to 2056.
I often use it at my work, on an ovh server with root ssh access and often have to change mod after having finished an operation. This command, replace the user, group and mod by the one required by apache to work.
Changing files ownership in a directory recursivley from a user to another
In the example, uid 0 is root. foo:foo are the user:group you want to make owner and group. '.' is the "current directory and below." -print0 and -0 indicate that filenames and directories "are terminated by a null character instead of by whitespace."
The fact that Linux exposes the ACPI tables to the user via sysfs makes them a gold mine of valuable hardware information for low-level developers. Looping through each of them and disassembling them all makes them even more valuable.
useful if you want to start running a svc as a non-privileged user instead of root.
requires: a directory with borked permissions and a backup directory that has the correct permissions. works with chown or chmod
Using $_ in the chmod command saved a good bit of typing ? obviously the $_ will contain the path to the file we?re talking about, as it was the last argument to the previous command. source: http://www.preshweb.co.uk/2007/07/bashs-_-variable-last-argument/ Show Sample Output
Back up /etc directory with a name based on the current date and the hostname of the machine, then chown the file for the current user for use.
Useful for sending as ARD command as root. Official apple sanctioned method for getting logged in user below: loggedInUser="$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')" Show Sample Output
This will change the ownership of /../../somedirectory as well as all its subdirectories so they will be be owned by user2 - typically used when a directory is owned by root:root
be careful where you execute this from do a 'sudo ls' beforehand to prime sudo to not ask for your password
Set Permission to user and group Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: