473,889 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use chgrp and chown for a directory ?

296 Contributor
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 22531
sicarie
4,677 Recognized Expert Moderator Specialist
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 Recognized Expert Expert
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 New Member
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 Contributor
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 Recognized Expert Moderator Specialist
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 Contributor
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
cybervegan
36 New Member
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 Contributor
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
cybervegan
36 New Member
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

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

Similar topics

0
7170
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. "nobody" Allways the same trouble: You would need to chmod your entire website by ftp-client/telnet, to have things like a php-based file-editor work...
2
5749
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 Sean
4
2597
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 owner of folder and files, so later I cannot delete/rename/transfer those files trough winscp. Only load them if permissions are set ok. Chown doesn't work, because only superuser can change file's owner. What can I do? Make 24 h agreement with...
4
3544
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 "Home Directory" tab is grayed out. Why would this be grayed out? Would this be a configuration thing or a permissions thing? I have an administrator account on this server
2
13790
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 the easiest way to take a huge project across onto it. Basically, I've hit a problem. I have no idea how the ifstream class handles directories. In the code I have (which I didn't write), there are several places whereby an ifstream stream is...
3
10067
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 the numerical uid and gid. My question is, is there a way for me to change ownership based on the name instead of the number? Perhaps there's a function that will let me lookup the uid from the username, and the gid from the groupname?
6
8946
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? I am running UDB 8.2 on Linux and AIX. Thanks.
6
1744
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> <Directory>Root</Directory> <Dir>true</Dir>
6
4267
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 this program has more then one class and also uses an interface. Right now I am working on ArrayBasedPD class. I am trying to write a code for the remove method (line 158) that allows the user to enter a name, once the program sees that the name is...
0
10785
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10439
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9603
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5825
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6025
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4644
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4249
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3253
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.