In my bash script I want to change file permissions on a particular file called "test.txt" which is located at :
"/var/www/tomcat7/dir1/test.txt"
My question is if I'm giving this full path to the file, I want to make change the permission on all the directories like, "var", "www", tomcat7", "dir1", and finally "test.txt".
File path is given via a separate text file as command-line arguments, and here is my code,
setFilePErmission(){
ssh [email protected] "sudo chmod 777 $1"
}
setFilePErmission $1
Can anyone help me? Thank You.... :)
chmod -R 777 /varand all the hierarchy below will get this change done.-R(recursive),chmodin/varwill automatically chmod in all directories inside/var, so you won't have to dochmod /var/wwwand thenchmod /var/www/tomcat7/and so on.