Change permission folder in Raspberry Pi to R permission - linux

The image below contain the command that change the permission for folder:
I want to change permission folder in Raspberry Pi to r permission it is folder for radio in /var/www. It failed and said "chmod: invalid mode: '-R' try chmod :--help to more information".

As already mentioned -R is not a permission, rather it's an option that sets the recursive mode on. The command you want is:
sudo chmod 777 -R PiFmRds/src
Note: chmod 777 is a dangerous permission setting. It means that literally everyone and everything can read, write, and execute the directory and everything below it.

Related

How to give permissions for specific commands in linux

I am new to linux. I have a build.sh file which consists of a lot of mkdir commands and some rm commands. But as I have installed this new in my VB, each time I run the .sh file, it says "Permission Denied for creating directory" and fails.
So is there any way that I grant directory privileges to all users.
Can anyone help me with this
Add "sudo" in the beginning of the directory creation command i.e
sudo mkdir dir_name
The issue might be with the directory in which the mkdir command is being run.
Use the command ll or ls -l to check the directory permissions.
If your directory doesn't have write privilege for the current user, you can run
chmod -R u+w /path/to/directory
This might require you to use sudo if permission is denied.
If you want to enable it for all users, run
chmod -R ugo+w /path/to/directory
Alternatively, a quick fix would be to run the build.sh file as root
sudo /path/to/build.sh
However, this approach is not advised unless you always run it as root

Give access to my application to read/write a file on var/www

In my application, I need to write a file.json in /myserver/home/www/var/myApplicationFolder/file.json but it does not work. (there is no problem in the code as it has already been tested)
I think it because of the root permission .
What should I do?
If you'd like any account on the server to be able to write to this folder then run:
sudo chmod 777 /myserver/home/www/var/myApplicationFolder/
or if you'd just like it to be able to write to that specific file:
sudo chmod 777 /myserver/home/www/var/myApplicationFolder/file.json
The chmod command takes 3 numbers which correspond to the permissions that the owner, people in the group, and everyone else gets respectively. The issue with the older answer was that they where giving the owner all the permissions (the first 7), but no giving any permissions to anyone else (the second and third 5).
In the terminal run the command:
sudo chmod 755 /myserver/home/www/var/myApplicationFolder/
it should work.

How to use chmod in ~/.bashrc

I would like to change the permission of a file in the /sys directory but the permissions keep reseting after reboot. I tried to add a chmod in the ~/.bashrc so the permission would change upon booting, but I get an error (operation not permited) in terminal. What would be the right way to do this ? Does the ~/.bashrc get executed as root ?
This is my command in ~/.bashrc
chmod 664 /sys/class/backlight/intel_backlight/brightness
And this is the error I get:
chmod: changing permissions of ‘/sys/class/backlight/intel_backlight/brightness’
: Operation not permitted
~/.bashrc is run as the user when the user logs in. It is not run on boot.
If you want to change the permissions on a file, you need to have permission to do so. The message is telling you that you don't have permission -- only root can do so.
The simplest way to do something custom on boot-up is to stick it in the file /etc/rc.local. This script is run by root after booting up (so on every reboot), so you can just stick your chmod command in there.

Enable write permission for directory in Linux

I keep trying to move files from a directory on Linux- but I keep getting permission errors.
Initially I was told
sudo chmod -R r+w /directory/*
But this only applies it to the directory folder (and not the files inside)
Trick is- you need to "select all" to apply the file permissions to:
sudo chmod -R a+rwx,go-w /directory/
And that's it
Or you could do sudo chmod 777 /dir/
and that's just a simple way to do the answer stated above.

ant Permission Denied problem

After extracting and saving the ant files into an opt/ directory and setting the path variable
to $ANT_HOME/bin
I ran the following command on a CentOS 5
ant -version
and I am getting the following error
-bash:/path/opt/apache-ant-1.8.2/bin/ant: Permission denied
Is there some permission I am supposed to set or some typical source of this problem?
Thanks!
If you own the file, try
chmod u+x /path/opt/apache-ant-1.8.2/bin/ant
If someone else owns it, either sudo or become root then
chmod 755 /path/opt/apache-ant-1.8.2/bin/ant
You need to have execute permissions on the file; the first gives execute permissions to the owner only and is probably preferable if you own the file and are the only one that uses it. The second requires root privileges and gives execute and read permission to everyone, plus write permission to the owner.
You can view the current permissions and ownership of the file by running ls -l /path/opt/apache-ant-1.8.2/bin/ant.

Resources