473,657 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to give root ownership to directory or files in directory?

7 New Member
I am log in as user student and i want that if i make any file in a particular directory is owned by root at the time of creation of file or sub-directory.
I used chown root /root/linux as a root user but it didn't work.
Dec 18 '10 #1
7 5085
sicarie
4,677 Recognized Expert Moderator Specialist
Did you receive an error when you ran the command?

What does an ls -alh /root/linux show? If you ran that command as root, and it didn't give an error, it should have updated the folder with the desired permissions.

You can always try running it under sudo as well.
Dec 20 '10 #2
Shwet Srivastava
7 New Member
No i didn't receive any error message b'coz i am running chown root /root/linux command as a root and root is already owner of that directory. I just want to do -
# useradd jk ; passwd -d jk
# useradd kk; passwd -d kk
# mkdir /data
# groupadd redhat
# usermod -G redhat jk ; usermod -G redhat kk
# chmod g+ws /data
# su - jk
$ cd /data
$ touch a b
Now as a user jk as a group member of redhat when I make a file in /data directory,it take root ownership not jk.
Dec 20 '10 #3
sicarie
4,677 Recognized Expert Moderator Specialist
And after you run it, what does the ls show?
Dec 20 '10 #4
Shwet Srivastava
7 New Member
# chgrp redhat /linux
I forget to write above line. After that
su - jk
$ cd /data
$ touch a b
$ ls -l
-rw-rw-r-- 1 jk redhat 0 Dec 21 01:48 a
-rw-rw-r-- 1 jk redhat 0 Dec 21 01:48 b
I want that when i create files in /data directory as jk a group member of redhat, at the time of creating the file that file owned by root user.
Dec 21 '10 #5
sicarie
4,677 Recognized Expert Moderator Specialist
But you're not chowning the files.

What does it show after you chown them to root?
Dec 21 '10 #6
Shwet Srivastava
7 New Member
It change ownership jk to root. But I want to do this at the time of creating the file by jk.
Dec 21 '10 #7
sicarie
4,677 Recognized Expert Moderator Specialist
I don't understand - you create the file, and you can change the owner of that file.

However, you want the user jk to create a file and have that file owned by root?

If a user creates a file, it's going to be owned by that user until someone with greater privilege changes that. Security logging is built around that concept.
Dec 21 '10 #8

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

Similar topics

4
2405
by: tarmat | last post by:
I've been using code such as the following, whereby I call the constructor of a class with an object allocated on the heap. The class is responsible for tidying up the memory. class Base{}; class A : public Base {}; class B : public Base {};
5
4230
by: Khalid | last post by:
II am allocating alot of memory for my problem model which uses stl containers for these pointers, will stl free the memory? by other words what is the semantics of memory ownership in stl? thanks a lot kh
8
1407
by: ali | last post by:
Hi, I'm trying to work on a recursive function that will give me root valuefor a given number. What i mean by root value is, if given 13, the answer is 1+3 = 4. If given 65, the answer is 2, i.e, 6+5=11, and 1+1=2. The final answer is always less than 10. I've been able to work on the code, but i can get it to work for
11
1874
by: Jacob | last post by:
I am trying to find the best way of documenting (in code and comments) ownership of secondary contained objects. This is my current status, and I would appreciate feedback on it: Case 1: When the secondary object is created with the object and dies with the object. Solution: Keep the secondary object as a stack variable, and
1
545
by: Jason Steeves | last post by:
I am trying to use the following button code to allow a user to enter an Active Directory account name and then have the system return the specified user' group memberships and the "ManagedBy" value for each group membership. Has anyone done this before? As it stands now it will just give back the group memberships and no "ManagedBy" values. Thanks for all your helpl. This code is from a button: CheckedListBox3.Items.Clear() Dim strDomain...
4
1884
by: _link98 | last post by:
Which of the UDB 8.2.2 ESE unix executables really need to gain root privilege while they are running? In my installation, the db2sysc file is owned by the instance-owner (and relevant admin group ownership), but when the db2-instance starts running (manually started via "su" as the instance-owner), the db2sysc process requests root access. I think that db2fmcd also requests root privilege.
2
4153
by: Andrew | last post by:
I spent tons of time searching the web for how to use .NET 2.0 and C# to modify Registry key security. After finally finding an example, and once I knew the function names a few other small examples.. I can still find nothing that demonstrates how to take ownership of a Registry key if one has (potentially) *only* "write owner" The problem, of course is that normally, to read or change permissions, one needs to "open" the registry key to...
9
7210
by: Andrew | last post by:
Apologies for the double-post.. I'm new, just getting used to this.. and should have posted this way in the first place.. How does one go about taking ownership of a registry key using C# & .NET 2.0 *IF* one has _only_ TakeOwnership privilege? The problem is exactly as specified in MS KB Article ID: 111546 at: http://support.microsoft.com/kb/111546/EN-US/ ...except that I would like to know how to do it in C#
2
5418
dlite922
by: dlite922 | last post by:
This is a totally n00b question but I'm saying good bye to Windows slowly and I've come across where I need to own a directory but I want to give write permission to Smarty (Apache user). Right now I change ownership back and forth. I don't want to give world permissions. Do i really HAVE to create a group with me and apache in it and give write permission to that group? Is there another way like windows to Select multiple users and give...
1
2021
by: rash123 | last post by:
Hi all, I have written one perl script to create and then change ownership of a folder in Linux platform.Folder got created ,but got error as :chown: changing ownership of folder:Operation not permitted Since this perl script has only local user privilege ,it is not allowing to change ownership of folder.If i run script as root ,it is working fine. But i want to run this script as local user.Is there any way to give chown privilege ...
0
8413
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8740
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
8513
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
7352
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...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
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
1733
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.