LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-02-2012, 07:52 AM   #1
rickyspires
LQ Newbie
 
Registered: Nov 2012
Posts: 3

Rep: Reputation: Disabled
How do i change permissions?


hello .

looks like you have solved the issue but im new to terminal and can't get it to work.. please could you help.

im typing in
Quote:
nano .bash_profile
it shows me
Quote:
export PATH=$PATH:/Applications/acquia-drupal/drush
then adding some code and saving and i get this...
Quote:
[ Error writing .bash_profile: Permission denied ]

if i do
Quote:
ls -ld /bin
i get:
Quote:
drwxr-xr-x@ 39 root wheel 1326 20 Jul 00:18 /bin

im not sure why its path is acquia-drupal ?

any way.. how can i fix it

thanks
 
Old 11-02-2012, 11:40 AM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,132
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
Are you trying to edit users or roots bash profile?
Quote:
Error writing .bash_profile: Permission denied
Quote:
drwxr-xr-x@ 39 root wheel 1326 20 Jul 00:18 /bin
If your trying to edit roots bash profile then you need to be root or use sudo.

If ~/.bash_profile (users) is owned by root then use chown and change the owner to user.
http://www.manpagez.com/man/8/chown/

what is the output of
Code:
whoami
and
Code:
ls -l ~/.bash_profile
 
Old 11-02-2012, 02:53 PM   #3
clocker
Member
 
Registered: Sep 2011
Distribution: fedora, redhat, mint
Posts: 87

Rep: Reputation: Disabled
Quote:
drwxr-xr-x@ 39 root wheel 1326 20 Jul 00:18 /bin
root or rather the owner of this file has read, write, execute permissions shown by rwx in the first 3 letters. whoami will tell who you are, do a
Quote:
ls -al
to confirm the permissions on the file. login as root or move yourself to the sudoers to save to this file. use chmod.
 
Old 11-02-2012, 03:15 PM   #4
rickyspires
LQ Newbie
 
Registered: Nov 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
how do i change the permissions ?

Hello

Thankyou for your reply

if i do
Quote:
whoami
i get my name
Quote:
rickyspires
if i do
Quote:
ls -l ~/.bash_profile
i get
Quote:
-rw-r--r-- 1 root staff 53 20 Oct 06:30 /Users/rickyspires/.bash_profile
if i do
Quote:
ls -al
i get these
Quote:
-rw-r--r-- 1 root staff 53 20 Oct 06:30 .bash_profile
-rw------- 1 rickyspires staff 12288 2 Nov 12:35 .bash_profile.swp
-rw-r--r-- 1 root staff 53 20 Oct 06:30 .bashrc

drwxr-xr-x 10 rickyspires staff 340 2 Nov 15:15 .git
-rw-r--r-- 1 rickyspires staff 21836 2 Nov 12:19 .git-completion.bash
-rw-r--r-- 1 rickyspires staff 107 2 Nov 12:38 .gitconfig

i'm trying to get Git Auto complete to work. so i'm doing the following:

Quote:
cd ~

curl -OL https://github.com/git/git/raw/maste...ompletion.bash

mv ~/git-completion.bash ~/.git-completion.bash

nano .bash_profile


//paste this in to the bash_profile file

if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
fi

i get this

Quote:
[ Error writing .bash_profile: Permission denied ]
 
Old 11-02-2012, 08:45 PM   #5
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,132
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
Quote:
-rw-r--r-- 1 root staff 53 20 Oct 06:30 /Users/rickyspires/.bash_profile
root is the owner of the file.
Either edit it as root or change ownership to user. (rickyspires) Users bash profile should not be owned by root.

Look at
Code:
man chown
Code:
man chmod
 
Old 11-03-2012, 11:25 AM   #6
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
Rick,

After editing with nano you cannot save what you modified because the .bash_profile is currently owned by the root. I assume, you are the owner of the computer, you have the root authority (if not then we cannot help.) What distro are you operating in? You should have given that detail first so that your friends here can easily help you.

Assuming you are running an ubuntu, you can do this right there in the /home/rickyspires folder:

Code:
rickyspires@host~$ sudo chown $USER:$GID .bash_profile
(( You can then enter your own password when asked ))

Followed by this:

Code:
rickyspires@host~$ sudo chmod 770 .bash_profile
If you are not running a sudo distro you may first obtain root authority by

Code:
rickyspires@host~$ su root
(( enter the "root" password not your rickyspires password ))

Then you can proceed to alter the ownership and permission by issuing above commands without prefixing them with sudo.

You can now edit and save your changes of the file.

Hope that helps and goodluck.

Last edited by malekmustaq; 11-03-2012 at 11:26 AM.
 
Old 11-03-2012, 03:46 PM   #7
rickyspires
LQ Newbie
 
Registered: Nov 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
hello

hi all.

think its working now.

all i did was type sudo su and enter my password. i could then enter code into the bash_profile file and it saved fine


thanks teckk and malekmustaq.

its a bit odd, if i input
Quote:
su root
it tells me
Quote:
su: Sorry
. its my computer and it only has 1 password as far as i know.

thanks
rick
 
Old 11-03-2012, 04:51 PM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,485

Rep: Reputation: 2485Reputation: 2485Reputation: 2485Reputation: 2485Reputation: 2485Reputation: 2485Reputation: 2485Reputation: 2485Reputation: 2485Reputation: 2485Reputation: 2485
If you are using Ubuntu or one of its derivatives, you get root privileges when you prefix a command with sudo and enter the password for the primary user.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] can't change permissions daisychick Linux - Newbie 9 02-20-2012 04:08 PM
can't change permissions manox Linux - Newbie 9 09-20-2011 09:21 PM
[SOLVED] How can I change file permissions in windows ntfs partition.Even root can't change it e3399 Linux - Newbie 3 03-02-2011 10:54 PM
[SOLVED] filesystem permissions question - making so user can't change permissions? c0pe Linux - Security 4 07-12-2010 09:06 AM
How to change permissions... mitchell7man Linux - General 6 05-31-2007 01:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration