# Folder permissions in Ubuntu



## djmykey (Sep 2, 2006)

Ok, so guys I did install Ubuntu 6.06 atlast. So now I have some problems. (No no not some dependencies problem, thank synaptic)

I have mounted my windows hard drives, i.e. all the hdd's that are partitioned as NTFS, by editing the fstab file. Now does the problem start. I edited the fstab file thru some sudo command given on the unofficial Ubuntu guide. 

So now what happens is the partitions do get mounted but I cant access them coz I dont have the rights to do so. Ok so I'm not so dumb and hence tried to check them out and then I find out that those folders were created by root. (what they were created by me.)

So then I go figure out u can't login as root into the console (duh was this necessary)
so I find out a workaround and then login as root and then I find out that still I cant change the permissions (hey this was unexpected)

So I want to know how can I access them through my djmykey login, I dun wanna login as root eveytime.

*Contents of /etc/fstab file*

```
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hda1       /               ext3    defaults,errors=remount-ro 0       1
/dev/hda2       none            swap    sw              0       0
/dev/hdb1       /home/djmykey/Songz     ntfs    user,ro,auto    0       0
/dev/hdc5       /home/djmykey/Toolz     ntfs    user,ro,auto    0       0
/dev/hdd1       /home/djmykey/MnP       ntfs    user,ro,auto    0       0
/dev/hdd5       /home/djmykey/Gamez     ntfs    user,ro,auto    0       0
```


----------



## Sykora (Sep 2, 2006)

To execute a command as root user from your own user account, prefix "sudo" to all your commands eg "sudo vim fstab" (or whatever editor you use).
The change that needs to be made to your fstab is this :
In the column where you have user,ro,auto , add the key "umask=022" . This gives permissions to the ntfs partitions.


----------



## djmykey (Sep 2, 2006)

U dint get it. I edited the fstab using sudo. But I dont have permissions to the folders or the mount points I have created where the hdd gets mounted. i.e. /home/djmykey/Songz. So just help me figure out that.


----------



## mehulved (Sep 2, 2006)

mikey rather mount them in /media/ or /mnt/ partition, That will help to show them in Places menu.
Do you mean you want to mount them manually without using mount command as sudo? eg.

```
sudo mount /dev/hdc5 /home/mikey/Gamez
```
Also, give 
	
	



```
sudo mount -a
```
 command and see if things work fine now?
If you cannot access the folders within the partitions then follow what Sykora said.


----------



## JGuru (Sep 2, 2006)

@djmykey, You should mount the Windows partitions in the '/media' directory or '/mnt'
 directory.
 Open the Terminal Window & login as root:
 $ su -
 (Enter password)
 # cd /home
 # chmod -R 777 /djmykey
 # exit

  In case you have not created a root password, here's how:
 $ sudo passwd root
  (Enter Password)
  (Enter password)
 Remember password not echoed!!Not even '*' is echoed!!
 This should solve your problem.


----------



## mehulved (Sep 2, 2006)

No don't create a root password. That's a big no-no. This entices people to use root account, which is not a good practise. If you want root access to a shell rather use 
	
	



```
sudo -s -H
```
 So, su is also out of question.


----------



## JGuru (Sep 2, 2006)

You are right @Tech_your_future. I have seen lot of people misuse the 'root' priviledges!!
 Yeah, better use 'sudo'

 type:
 $ sudo -s -H nautilus


----------



## djmykey (Sep 2, 2006)

Guys guys thanks for all the suggestions but I'm cool with the mount points and all. The thing is I edited the fstab file with the sudo command and hence I cant access the mountpoint folders itself. If I could access those folders I can access the files in it as well so anything to help me with that.

Am attaching a screenshot of the permissions to help u ppl ring any bells.
 *img108.imagevenue.com/loc494/th_00889_problem_122_494lo.jpg


----------



## ~Phenom~ (Sep 2, 2006)

hey guys , a friend of mine yesterday reset the root password of many computers of our college , while he was logged in with another user. How is it done??? our linux teacher was completely impressed  by him, may i know the trick???
The linux was Red Hat 9.


----------



## Pathik (Sep 2, 2006)

hey dats not possible.... btw my teacher wd hav kicked me out of d class..


----------



## santu_29 (Sep 2, 2006)

u can do that by using passwd command via telnet, however you need to be logged in as root(su).


----------



## djmykey (Sep 2, 2006)

Ok guys u ppl really deviated frm the subject but I found the error that I made

In the options after mentioning that the drive was an ntfs I used this

*user,ro,auto* 

where I was supposed to use this 

*nls=utf8,umask=0222*

that did it.

@JGuru:- This was a scary command

*# chmod -R 777 /djmykey*

U wanted me to change the file permissions on each and everyfile cmon dont tell me man ur good at linux man.

Anyways this topic is finished. This was created due to my laziness anyways so u ppl can lock it now.


----------



## praka123 (Sep 2, 2006)

djmykey said:
			
		

> @JGuru:- This was a scary command
> 
> *# chmod -R 777 /djmykey*
> 
> U wanted me to change the file permissions on each and everyfile cmon dont tell me man ur good at linux man.




```
[B]# chmod -R 744 /djmykey[/B]
```
that will do


----------



## mehulved (Sep 2, 2006)

That will of course do prakash but won't it open up all the files in other partition to be read, written and executed by everyone?


----------



## praka123 (Sep 2, 2006)

yup its wrong suddenly thought of executables 
__________
but again 755 is the default permission system wide afaik


----------



## gary4gar (Sep 3, 2006)

well there is a gui method of changing folder perimissions also.
open nautilus as root and right click on folder and select the permissions tab. now change the permissions.


----------



## mehulved (Sep 3, 2006)

gary4gar said:
			
		

> well there is a gui method of changing folder perimissions also.
> open nautilus as root and right click on folder and select the permissions tab. now change the permissions.


Not really needed in this case as mikey seems comfortable with CLI. And it's better to stick to CLI as the GUI method will change for different file managers, that's why people ask to stick to CLI. One CLI can have many frontends with some variations in method of operations but mostly CLI will only be done by one method and it's not at all difficult to remember such a small command.
I am sure people used to remember all the commands in days of DOS.


----------



## djmykey (Sep 3, 2006)

Guys guys guys enuff of this discussion. Dont u ppl get it. I already solved the problem. U know what is the problem with this forum ppl out here really think that they know something abt a certain problem (actually they do know a lot but...) and give some advice but the advice doesnt sound in the way it must and hence lot of ppl r misled and go groping around in the dark, So ppl no offence but this thread is over. And what the hell were u ppl discussing about. U know what go and mount a ntfs partition as I did in in the first hand and use the options I did using sudo and see what it does. Inspite of giving repeated posts that the GUI of the permissions r not working u ppl still insist that it shud b done in that way. Where r ur brains. I dint expect this from u senior ppl. U can fry me off this forum but I'm not at all impressed. I told u also that I cant get anything to do, I just cudnt touch the folder permissions coz the mounting itself was wrong and u ppl without checking the mounting options went on the rant abt permissions. Anyways my hands r paining coz of the typing I did yest so I end it here. And I had pm'ed a mod to close this thread. Maybe they dint recieve it or anything but pls any mod reading this pls do close this thread.


----------



## mehulved (Sep 3, 2006)

mikey the answer has been given by Sykora in the first reply itself. As far as I can see, the solution you got and sykora suggested are the same.


----------



## Sykora (Sep 3, 2006)

Permissions for individual files are done after mounting, but permissions for the whole filesystem is done at the time of mount. You didn't tell linux how to mount your filesystem, so you couldn't touch anything.

And here I was, thinking that my advice in my first reply was to-the-point. Ah well.


----------



## gary4gar (Sep 3, 2006)

carry on


----------



## ~Phenom~ (Sep 6, 2006)

Ok guys , I told u that my friend changed root password , this is how he did that :

 Start ur Computer

Option to select the OS appear to u.
Such as Redhat & Other

Using arrow Keys go to-
Redhat or Fedora Option

Then "Press e"
Then 3 options are displayed to u.
Using arrow keys select the middle option.

Then again " Press e"
A screen is open in front of u.
Press spacebar and type single
Then "Press b"

Linux boot mode starts, it takes some time.

After that it shows sh#
then type
passwd root
It will say u to enter new linux password
Retype the password
then type "exit"
PC will reboot
The password which u set is set as the root password.

Password is Changed. ...........
Now enjoy the freedom to linux root.



Donno if it works , but he told me that he has done it this way only.


----------



## Pathik (Sep 6, 2006)

did ny1 try this.... does it work... btw the procedure sounds to me like getting into safe mode or rescue mode of linux....


----------



## mehulved (Sep 6, 2006)

Yes this is the procedure of going into rescue. This gives you root access, now anything can be done. This is a very simple technique. 
One of the reason why majority of the servers are kept away in such a place so as no one can reach them. Also, having a grub password helps in this case. Maybe you can suggest this to your teacher as a solution.
Another method could have been throught sudo. If you can access root shell as sudo, then it's possible to change the root password, unless it's been configured so.
__________
Forgot to add, it is known as single user mode, that's why the parameter single was passed.


----------

