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.
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.
Create a script
Similar to this you can modify as per your need
$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.
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:
Make this executable and put it in your PATH variable and use it something like this.
# ./x.sh user group permission file_name