Why Isn't `Chmod` Command Functioning in Kali Linux 2020?

Why Isn't `Chmod` Command Functioning in Kali Linux 2020?

I am basically really new at Kali and I have no previous experience in other OS other than Windows. I am trying to learn Kali using various tutorials on Youtube and I was basically learning ipsweep (I think it is called that only ) using .sh file programmed in /bin/bash, i tried to make a file executable in root using the

chmod -x filename.sh
sudo chmod -x filename.sh
chmod -rwx filename.sh

I thought I didn't have enough permissions because it showed no bash error but when i tried ./filename.sh it said permission denied. Then I saw if the file is executable or not but it showed something rather strange: it showed that the chmod command wasn't even executed (I think i am still very bad at understanding this). How to do this right?

3

1 Answer

chmod -x removes the execute permission. If you want to make the file executable you need +x:

chmod +x filename.sh

Furthermore the file needs to be readable (chmod +r filename.sh). With chmod -rwx filename.sh you have removed all the permissions, including this one. The dashes (which are displayed in your terminal as one long line) in the output of ls -l indicate chmod worked perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.