I am trying to edit my .mycshrc file to add in more shortcut commands in my terminal.
However, I realize there is a problem.
It appears that my file was replaced by a senior (he is gone, the same goes to the computer) and I am unable to edit it due to the permission rights where the options in the Permissions tab are all greyed out.
I tried typing chmod 644 .mycshrc and I was given the error: chmod: changing permissions of .mycshrc': Operation not permitted
Then I tried to create a new plain text document file, rename it as .mycshrc and it ain't working even as I have added in new commands unless I am doing it wrong..
The following is a sample that I am trying to add it in:
alias designer '/apps/Linux64/qt/qt-4.5.0/bin/designer'
You need to change the user, and not the file mode in this case. Use
sudo chown youruser:youruser .mycshrc
where youruser is your username.
In any case, the chmod 644 .mycshrc was failing because you aren't the owner of the file (the senior's user account is the owner most probably since he replaced it). That is precisely the reason why you need to do the above step with sudo, as the root user.
Find out a easier way to handle the problem I am facing.
Delete away the old file
Create a new file (make sure file format is the same as the old one)
Add in any new alias if necessary
type source ~/.mycshrc in command line
Viola~ It works!
Make sure you are in the directory when the file is being saved since it works for me in this manner
Related
I am supposed to give write/edit permission to my directory in /var/lib/mysql/dbname via Linux.
I am unaware of backend UI and i know i just enetered the text "sudu so" # centos machine which displays :
[root#ip-10-0-0-61 centos]#
Can anyone tell how to proceed further as I have always been using WinScp which restricts me to write database files due to present set permissions.
Any user interface file manager that could do this would be really helpful too.
Thanks in advance
You can change files/folders permission with the chmod command. There's a man page here. The full command line to type depends on which permission you exactly need. A basic usage of the command is
chmod [ugoa][+-=][rwx] file
Where
[ugoa] allow you to choose whose permission you want to modify: the owner of the file (u), users member of the group of the file (g), any other users (o) and all users (a)
[+-=] allow you to tell the command if you want to add (+) the selected permissions, remove them (-) or set them as the only permissions of the file(=).
[rwx] allow you to choose the permission : read (r), write (w) or execute (x). There exist other type of permissions explained in the man.
To change the permission of a folder recursively, you can add the option -R to the command.
Very simple just execute the command
chmod 777 -R ./
This will do the trick for you.
There are two things to look at, setting permissions, and ownership.
To do this for an entire directory (be careful with this)
chmod -R {permissions} {directory}
If you're unsure what permissions to use check this guide
To set ownership, use
chown {user:group} {directory} -R
Again be careful with these settings. It's not often you'll want an entire directory full of files to all have the same permissions, and you could be opening yourself up to risks if you do so. Always be explicit and give each file the minimum permissions needed to get the job done.
I just installed Atom, and I am getting an error thrown up when I go to save the project.
Unable to save file: Permission denied
I am signed in with admin privileges.
Try running:
sudo chown -R username:www-data /path/to/directory
"username" being what gets spit out when you enter
whoami
Digital Ocean's tutorials are pretty good for installing stuff the right way. I got the above from https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-16-04
This is because of linux permissions. The best way to solve this problem is by providing permission for the user. This can be done by chown command.
sudo chown -R username:groupname directory
You can find your username using whoami command and your group name by using groups username command.
Let's say you got "john" as your username. To get groupname you run the command
groups john
You will get an output something like this
john : john staff adm cdrom lpadmin admin
The first name after : is your primary group. In the example it is "john"
The command will be
sudo chown -R john:john /opt/lampp/htdocs
This isn't an atom problem, it's a linux permissions problem.
You opened a file owned by another user (a file probably owned by root). If you want to edit that file, you have to either be root or change the permissions on the file to grant other users access.
Usually the best solution is to temporarily become root and edit the file:
sudo atom /path/to/file
if your case is same situation as this screenshot
try this
$ sudo chmod -R 777 ~/.atom
there is alot of ways to solve this problem, i just change the permisions on the proyect folder:
sudo chmod 777 /path/to/folder/proyect
This is happening because linux don't have permissions. The best way to solve this problem you have to provide permission for the user to access particular directory/folder or file.
Please follow the below steps to give permission.
First find your username by entering the following command in console.
whoami
You will get an output something like this
jrathor
You got "jrathor" as your username.
Now provide permission to that particular folder/directory or file which one you are not able to access.
sudo chown -R jrathor /path/to/folder/or/file
Now you can edit all the files which is available in directory.
It Will work for ubuntu as well as for MAC also.
If you get this error in ubuntu 20.04 as well, I found a solution.
In terminal(ctrl + alt + t), you can access to root using this order 'sudo su'.
Give your password then go to the directory exactly atom want to save.
First,'cd' to find right directory. then again, 'cd /usr/bin'.
Now you are in the directory /usr/bin. Type 'touch atom'. It will make atom txt file in your path. And type 'exit'
sudo chown -R username:www-data /path/to/directory
"username" being what gets spit out when you enter
whoami as #sam said above.
Go to atom, try save the file again. atom will be saved successfully.
before run your file with atom , if you change your file write permission other users can save it
you can read from here for permission linux-permission
$su -
password:
chmod 777 index.php
open new terminal and run your file with texteditor
$ atom /var/www/html/wordpress/index.php
It might be late to answer this, but I tried this and resolved my issue:
(Disclaimer : I tried to save changes in keymap.cson file in atom, got error : Unable to save changes : Permission denied)
chmod 777 <file name>
and after that,
go to the file "keymap.cson".
right click and go to properties.
un-check hidden check-box.
you are good to save changes in keymap.cson in atom
Happy saving :)
This same problem occurred on my Mac running OSX.
Problem:
for some reason npm created the react app with Read & Write permissions to System for only the app folder, although all files and folders contained had read/ write permissions to me, the creating user.
Solution:
You'll need the admin password.
Visit the app folder in Finder, like, "directory/ReactApps/react-app/...", right-click and click the dropdown menu for "Permissions", click the padlock icon in the bottom right of that pane and enter the admin password, create a new user by clicking "+" icon, select yourself, and Read/Write permission, click the (unlocked) padlock icon again.
Copy your current code in Atom, quit Atom (cmd+q), restart, select the file, select all (cmd+a), paste, then save (cmd+s).
Onward
If you are using AWS cloud 9 lightsail (magento in my case) use:
sudo chown -R bitnami:bitnami /opt/bitnami/apps
this will allow you to have full access to your file tree to create new folders and files. (may do more not sure, as im now to this).
Thank you,
I have created directory and set read only permission for root using chmod.
chmod -R 400 some_dir/
but when I try to create any file inside it using touch, I was expecting error message something like
touch some_dir/hello.txt
"touch: cannot touch `some_dir/hello.txt': Permission denied"
but it creates file "hello.txt" inside it happily, but directory permission if I check it still shows readonly for root. Please explain what I'm missing here, since I was expecting error message which would be displayed if any other user(apart from root) try to create file in that directory?
PS: I'm running as root user.
Short answer is - Yes, Root user can create files in a directory that is marked as Read Only. You may argue - why? But that's the whole point of root account. It's a special user and it can do things that others can't.
If you want to prevent the file from accidental modifications, you can set the i attribute of the file on with chattr +i command. This will make the file unchangeable. However, note that it will only prevent accidental modifications. Root users can still just unset the attribute first and then modify the file.
I have a quick question. I've been trying to upload my website to blue-host, but every time I try, it says that parent path doesn't exist, is there a way I can change the parent path so the uploads work
Thx,
willmonferno
This is likely due to file permissions, you don't have write access, try updating file owner or file permissions.
I'm guessing you on some type of linux system, so you either need a chown (change owner) shell command or a chmod command (change file permissions) on the parent folder
try:
sudo chmod -R 777 {YOUR_PARENT_FOLDER}
This will recursively change this and all other files and folders below it in the file tree to allow everything. I would change it once you're in a production environment.
This is the second time i've had this occur to me.
I am working on a rails app, and I create a file via touch show.html.haml, and I can do an ls and see the file.
but I am using both WinSCP and SFTP for sublime, and neither can see this file!
WinSCP returns...
and Sublime returns,
Downloading folder "/app/qa/www/htdocs/qa-dashboard/app/views/scripts/" ... 1 file to download
yet it never downloads the file. What is happening here? I've also verified that it wasn't the touch command. i've tried vi'ing the file, and saving it. Same thing.
I've also verified that the hosts are matching.
Additional notes:
I am using elevated_user to create the file, and user, ddavison to edit the file. ddavison is not in the group.
File modes are,
drwxrw-rw- ... .
drwxr-xrwx ... ..
-rw-rw-rw- ... show.html.haml
The permissions on your scripts directory appear to be incorrect:
drwxrw-rw- ... .
^--^-- missing eXecute bit
The execute bit on directories allows the directory's contents to be listed. Since the "group" and "other" perms on the scripts directory do not allow listing, you'll get that error. Most like you're logged in to the shell as the owner of the directory, so you can get listings all you want, but you're logging in as a user OTHER than the owner via winscp, so they're unable to list the directory contents.
I expect the problem is with the permissions on the containing directory -
drwxrw-rw- ... .
Both of those programs probably try to chdir into that directory before retrieving the file. In order to do so, the directory must have x (execute) permissions for the user they are logging in as. Based on what you said, it seems that set 'other' needs +x -
chmod o+x /app/qa/www/htdocs/qa-dashboard/app/views/scripts/
Depending on the users/groups in question, you may want to consider removing write permission -
chmod o-w /app/qa/www/htdocs/qa-dashboard/app/views/scripts/
For directories, the x permission bit isn't execute, rather it's "list the contents of this directory". Since the directory's permissions are only 'rwxrw-rw-', only the owner may list the contents of the directory. Provide "other" that permission using chmod o+x /app/qa/www/htdocs/qa-dashboard/app/views/scripts.