473,396 Members | 2,018 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,396 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 22477
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.