473,382 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to use chgrp and chown for a directory ?

296 100+
Hello,

Howto change the group and owner of a directory .

I am doing this -->

Expand|Select|Wrap|Line Numbers
  1. chgrp -R groupname directoryname
but its not working .
Feb 14 '07 #1
20 22476
sicarie
4,677 Expert Mod 4TB
Hello,

Howto change the group and owner of a directory .

I am doing this -->

Expand|Select|Wrap|Line Numbers
  1. chgrp -R groupname directoryname
but its not working .
chgrp is not the command you need, it is chown.

You can always 'man *command*' to see what they do and how they are supposed to work.
Feb 14 '07 #2
drhowarddrfine
7,435 Expert 4TB
He wants to do both. What he's doing should change the group owner so I'm assuming he doesn't have permission to do so. Are you getting an error?
Feb 14 '07 #3
cassbiz
202 100+
the chown command is

Expand|Select|Wrap|Line Numbers
  1. chown user.group file
  2.  
if you want to change the directory name then replace file with the name of the directory.
Feb 14 '07 #4
pankajit09
296 100+
Actually I have mounted Windows partition on Debian.

The filesystem is ntfs.

When I enter the mount command it shows read/write.

But when I fire the message which comes is that its a read only file system.

Expand|Select|Wrap|Line Numbers
  1. chown pankaj.pankaj /mnt/win/
  2. chown: changing ownership of `/mnt/win/': Read-only file system
The above message tells that the ownership has been changed but actually its not been changed.
Feb 15 '07 #5
sicarie
4,677 Expert Mod 4TB
Actually I have mounted Windows partition on Debian.

The filesystem is ntfs.

When I enter the mount command it shows read/write.

But when I fire the message which comes is that its a read only file system.

Expand|Select|Wrap|Line Numbers
  1. chown pankaj.pankaj /mnt/win/
  2. chown: changing ownership of `/mnt/win/': Read-only file system
The above message tells that the ownership has been changed but actually its not been changed.
What command did you use to mount the fs?
Feb 15 '07 #6
pankajit09
296 100+
What command did you use to mount the fs?
I first did this and the fs was mounted -->

Expand|Select|Wrap|Line Numbers
  1. mount -t ntfs /dev/hda1 /mnt/win
Then I made the following entry in the fstab -->
Expand|Select|Wrap|Line Numbers
  1.  /dev/hda1 /mnt/win ntfs noauto,user 0 0
Feb 15 '07 #7
What you need to do is chown the directory *before* you mount the filesystem on it. NTFS filesystems don't support *Linux* file permissions and ownerships, so you can't use chown on the files within them (they get their ownership from the directory on which the fs is mounted).

Unmount the filesystem, and then do:

ls -l /mnt

this will show you the owner and group that are assigned to all the mount points inside /mnt. You can then use chown to set the ownership, and chmod to set the permissions as you desire. Then mount the filesystem, and it should work.

hth,
-cybervegan (RHCT)
Feb 15 '07 #8
pankajit09
296 100+
What you need to do is chown the directory *before* you mount the filesystem on it. NTFS filesystems don't support *Linux* file permissions and ownerships, so you can't use chown on the files within them (they get their ownership from the directory on which the fs is mounted).

Unmount the filesystem, and then do:

ls -l /mnt

this will show you the owner and group that are assigned to all the mount points inside /mnt. You can then use chown to set the ownership, and chmod to set the permissions as you desire. Then mount the filesystem, and it should work.

hth,
-cybervegan (RHCT)

I did that but whenever I mount the owner and group automatically change to root.
Feb 15 '07 #9
Ah, you need to add to your mount command:

-o uid=username gid=groupname

(Replace username and groupname with appropriate real user and group names)


You may also want to use the umask= option too. See the linux man page for mount for more details (there's a section for each filesystem type, search for ntfs by typing '/ntfs').

If you want this configured permanently, you need to add an entry to your system's /etc/fstab file with the parameters you give the mount command, again, man fstab for the details.

hth,
-cybervegan
Feb 15 '07 #10
drhowarddrfine
7,435 Expert 4TB
Is 'mount_ntfs' available on Linux?
Feb 15 '07 #11
pankajit09
296 100+
Is 'mount_ntfs' available on Linux?
What do you mean by that ?
Feb 16 '07 #12
pankajit09
296 100+
Ah, you need to add to your mount command:

-o uid=username gid=groupname

(Replace username and groupname with appropriate real user and group names)


You may also want to use the umask= option too. See the linux man page for mount for more details (there's a section for each filesystem type, search for ntfs by typing '/ntfs').

If you want this configured permanently, you need to add an entry to your system's /etc/fstab file with the parameters you give the mount command, again, man fstab for the details.

hth,
-cybervegan
When I fire the mount command I get this -->

/dev/hda1 on /mnt/win type ntfs (rw,uid=1000,gid=1000)

My /etc/fstab file has entry like this -->

/dev/hda1 /mnt/win ntfs ro,defaults,user,umask=0222 0 0

Is everything fine ?
Feb 16 '07 #13
When I fire the mount command I get this -->

/dev/hda1 on /mnt/win type ntfs (rw,uid=1000,gid=1000)

My /etc/fstab file has entry like this -->

/dev/hda1 /mnt/win ntfs ro,defaults,user,umask=0222 0 0

Is everything fine ?
Sorry for the delay in responding!

Adding the "user" flag allows ordinary users to mount the device. I'd add gid=grpno too (where grpno is the numeric group number of a group that you want to allow to use /mnt/win - and add all users who should be able to access the windows partition into the relevant group).

hth,
-cybevegan
Feb 20 '07 #14
drhowarddrfine
7,435 Expert 4TB
What do you mean by that ?
I mean is the "mount_ntfs" command/script available on Linux?
Feb 20 '07 #15
chown -R user_Name:user_Name directory_Name
chgrp -R user_Name directory_Name
Feb 20 '07 #16
pankajit09
296 100+
I mean is the "mount_ntfs" command/script available on Linux?

I don't think becoz when I entered "man mount_ntfs" no result.
Feb 21 '07 #17
pankajit09
296 100+
chown -R user_Name:user_Name directory_Name
chgrp -R user_Name directory_Name
I think this should be correct -->

chown -R owner_name directory_Name
chgrp -R group_name directory_Name
Feb 21 '07 #18
pankajit09
296 100+
Sorry for the delay in responding!

Adding the "user" flag allows ordinary users to mount the device. I'd add gid=grpno too (where grpno is the numeric group number of a group that you want to allow to use /mnt/win - and add all users who should be able to access the windows partition into the relevant group).

hth,
-cybevegan

So is this correct -->

/dev/hda1 /mnt/win ntfs ro,defaults,user,umask=0222,gid=1000 0 0

How to include all the users ?
Feb 21 '07 #19
So is this correct -->

/dev/hda1 /mnt/win ntfs ro,defaults,user,umask=0222,gid=1000 0 0

How to include all the users ?
It works like this:
groupadd winusers
usermod -G winusers fredb
usermod -G winusers bills
usermod -G winusers mayf

hth,
-cybervegan
Feb 21 '07 #20
I think this should be correct -->

chown -R owner_name directory_Name
chgrp -R group_name directory_Name


chown -R owner_name:group_name directory_Name
Feb 21 '07 #21

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Fronq | last post by:
Hi ! The entire (PHP-) world seems to have the same problem: Many providers let you upload as one user, lets say "ftpuser", yet then apache and your script will run as another user e.g....
2
by: Sean | last post by:
What is meant by: "CHOWN the entire casetracker folder to something that permits the server to write to it, such as apache.apache, or whatever your Webmaster recommends" - is that 700 or 777...Help...
4
by: Perttu Pulkkinen | last post by:
I have a form handler script that creates a new folder for the files sent in the form. Move_uploaded_file transfers then puts those files there. But problem is that apache becomes automaticly...
4
by: Ed | last post by:
Hello All, I posted earlier about a problem I was having with editing or pasting/deleting files in the "Home Directory" of my web server. I just noticed that the "Home Directory" option in the...
2
by: Dave Johnston | last post by:
Hi, I'm currently trying to create a wrapper that uses C functions but behaves like ifstream (from fstream.h) - this is because the platform I'm using (WinCE) doesn't support streams and this is...
3
by: James Colannino | last post by:
Hey everyone. I tried to use os.chown() in the following manner: os.chown('filename', 'username', 'groupname') I got an error, and when I googled for this function I realized that I must pass...
6
by: Hemant Shah | last post by:
Folks, I need to move HOME directory of an instance to another directory. What is the best way of doing it? Is changing password file enough? or dies DB2 store this info in it's own config? ...
6
by: dave | last post by:
I really have 2 questions regarding the following xml snippet. The xml is a directory representation. <?xml version="1.0" standalone="yes"?> <FileSystem> <Row> <ID>1</ID> <Name>Root</Name>...
6
by: falconsx23 | last post by:
I am trying to write a code for a Phone Directory program. This program is suppose to allow the user to enter a name or directory and then program can either add, save or even delete an entry. Also...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.