Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to change owner/group of a file AND permissions with 1 command?
I tried:
chmod user1:groupOfUser1=770 file.txt
but it does not work.

share|improve this question
Make a shell script that combines the chmod and chown commands? – DerfK Dec 14 '12 at 12:53
@DerfK Indeed. Or alias. Or a Bash function. – gertvdijk Dec 14 '12 at 13:17
My thoughts are that the answer might be in some the usage of setfacl. Is it possible to update owner/group and default permissions with setfcacl? – Zoredache Dec 15 '12 at 1:07

Create a script

Similar to this you can modify as per your need

cat chmodown

chmod $2 $1 $5
chown $3:$4 $1 $5

$1 is file name $2 is permission $3 user name $4 Group name $5 (-R) for recursive.

You can then place the same script to "/usr/bin/" too.

chmodown install.log 777 test root
ls -al install.log
-rwxrwxrwx 1 test root 18262 Jul 27 01:52 install.log
share|improve this answer

I don't think that's really possible.

I expect that what you are looking for is to input file name just once. You can do something like this

# for a in file.txt; do chown user1:groupOfUser1 $a; chmod 770 $a; done

Over here you need to input the file name just once :)

At the same time, you can use shell script like this:

chown $1:$2 $4
chmod $3 $4

Make this executable and put it in your PATH variable and use it something like this.

# ./ user group permission file_name

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.