Chown script

#!/bin/sh for dir in `ls -A | grep -v .sh`; do chown -R $dir:$dir $dir done

-8
By: gg
2009-04-10 15:29:30

These Might Interest You

  • requires: a directory with borked permissions and a backup directory that has the correct permissions. works with chown or chmod


    0
    for x in `find /dir_w_wrong_ownership/`; do y=`echo "$x" | sed 's,/dir_w_wrong_ownership/,/backup_dir/,'`; chown --reference $y $x; done;
    foucault · 2011-02-21 22:15:33 0
  • (Please see sample output for usage) script.bash is your script, which will be crypted to script.secure script.bash --> script.secure You can execute script.secure only if you know the password. If you die, your script dies with you. If you modify the startup line, be careful with the offset calculation of the crypted block (the XX string). Not difficult to make script editable (an offset-dd piped to a gpg -d piped to a vim - piped to a gpg -c directed to script.new ), but not enough space to do it on a one liner. Show Sample Output


    5
    echo "eval \"\$(dd if=\$0 bs=1 skip=XX 2>/dev/null|gpg -d 2>/dev/null)\"; exit" > script.secure; sed -i s:XX:$(stat -c%s script.secure): script.secure; gpg -c < script.bash >> script.secure; chmod +x script.secure
    rodolfoap · 2013-03-09 11:16:48 5
  • You can upload via ftp the script.sh in unix text format, and then upload a file called run.txt to execute once the script. Such script can be multiline. If the script fails a failed.txt will be generated that you can see via ftp.


    0
    watch -n10 "if test -e run.txt ; then chmod +x script.sh && ./script.sh && rm run.txt || rm run.txt && echo > failed.txt ; fi"
    bugmenot · 2012-07-29 00:38:08 1
  • echo "ls" > script.bash; This is my script, a simple 'ls'. gpg -c script.bash; Here I encrypt and passord-protect my script. This creates file script.bash.gpg. cat script.bash.gpg | gpg -d --no-mdc-warning | bash Here I open file script.bash.gpg, decrypt it and execute it.


    -2
    echo "ls" > script.bash; gpg -c script.bash; cat script.bash.gpg | gpg -d --no-mdc-warning | bash
    betsubetsu · 2013-03-10 09:34:12 1

What Others Think

What exactly is the aim of this? To change the owner of every file that doesn't have .sh in its name to itself?
dfego · 479 weeks and 5 days ago
maybe it is to run on /home.... why you need a script, or have messed up permissions is beyond me.
ozymandias · 479 weeks and 5 days ago
Looks like it. The only place you'd ever get anything but massive errors out of this is in /home.
TheMightyBuzzard · 479 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

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.

Share Your Commands



Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: