LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   can I chown to anyone on the system? (https://www.linuxquestions.org/questions/linux-general-1/can-i-chown-to-anyone-on-the-system-699268/)

newbiesforever 01-22-2009 10:14 PM

can I chown to anyone on the system?
 
I just had to chown my backup hard drive to my account. No problem with that, but I just wondered something. This is academic, because I'm the only user; but if there were others or if I had more than one account (notwithstanding that I have no idea why I would), could I chown to "anyone," whatever the syntax might be?

pixellany 01-22-2009 10:34 PM

If you have admin (root) privileges, you can change anything and everything.

newbiesforever 01-22-2009 10:43 PM

Good. Then what's the syntax for "anyone" when chowning?

jschiwal 01-22-2009 11:44 PM

man chown & man sudo.

If you want to allow everyone to have access, then use chmod to enable "o" (others) access. If all users are a member of a group such as "users", then you could change the group ownership of the file.

rweaver 01-23-2009 09:13 AM

Quote:

Originally Posted by newbiesforever (Post 3418164)
I just had to chown my backup hard drive to my account. No problem with that, but I just wondered something. This is academic, because I'm the only user; but if there were others or if I had more than one account (notwithstanding that I have no idea why I would), could I chown to "anyone," whatever the syntax might be?

There are two programs, chown and chmod.

chown changes ownership.
chmod changes permissions (for owner, group, and "anyone").

Let me give you an example:

Code:

school:~# ls -l
drwxr-x--x 2 root    staff 4096 2009-01-23 07:40 dir1
-rw----r-- 1 student staff    0 2009-01-23 07:40 file1

Lets break this down a bit for dir1 we have...
Code:

d  <- bit telling us this is a directory
rwx <- Owner rights
r-x <- Group rights
--x <- Everyone elses rights

For directories (r) means list the contents of the directory
For directories (w) means modify contents of the directory or create new
For directories (x) means make the directory your working directory

For file1 we have...
Code:

-  <- nothing special
rw- <- Owner rights
--- <- Group rights
r-- <- Everyone elses rights

For files (r) means you can read the contents of the file
For files (w) means you can change the file or delete it
For files (x) means you can tell the system to execute the file

If I was root and wanted to create those files like that here is what I would do:

Code:

mkdir dir1
touch file1
chmod 0751 dir1
chmod 0604 file1
chown root:staff dir1
chown student:staff file1

I've always found numeric permissions easier to grasp and understand because they're simple addition: r=4, w=2, x=1. Add them up for each section... rwx=4+2+1=7 rx=4+1=5 x=1, rw=4+2=6 none=0 r=4. I think learning them this way in the long run makes it easier when you find a need to understand umask also. There are some special bits you can add too, like setuid, setgid, sticky bit (that's what the first 0 represents), but if you understand the basics its all much easier.

Any who I'll shut up now ;)

If you need better examples or want to look at the alternate syntax using the non-numerical method, you can look at the wikipedia article for the two programs which explain them quite well in my opinion and even offer good examples.

chmod - chown

renjithrajasekaran 01-24-2009 09:14 AM

So - You're telling me that an admin can simply chown any of the "restricted" files on my home folder and view them?

Seriously ???

Linux Archive

custangro 01-24-2009 11:31 AM

Quote:

Originally Posted by renjithrajasekaran (Post 3419717)
So - You're telling me that an admin can simply chown any of the "restricted" files on my home folder and view them?

Seriously ???

Yup.

-C

Lordandmaker 01-24-2009 12:46 PM

Quote:

Originally Posted by renjithrajasekaran (Post 3419717)
So - You're telling me that an admin can simply chown any of the "restricted" files on my home folder and view them?

He wouldn't need to chown them.

Quakeboy02 01-24-2009 02:33 PM

Quote:

Originally Posted by renjithrajasekaran (Post 3419717)
So - You're telling me that an admin can simply chown any of the "restricted" files on my home folder and view them?

Seriously ???

It sounds like it's not your system, so you need to get into the mindset of using other people's property. The admin is god. He can view your files, delete them, copy them, and suspend or remove your access to the machine. Normally none of these things are done, as the admins have more important things to do than to peruse their users' files. But, it's important to keep this in mind when deciding whether to put personal files on your company's/school's computers.

maginotjr 01-24-2009 11:00 PM

root is the God on your system but you always can try to hide something from him, like using some tool like EncFS that Encryptate any folder giving you the power to own the only key to open them (some password of course not a real key), at the same time root may seem an strange concept its the most powerfull concept on a unix system.

talking about chown and chmod I would sticky with jschiwal, use man, dont make so simple questions, realy. We notice that you are very new to linux and you have to learn first to search for the answers on the net or in the man pages.
Man pages are simple tu use you just need to type in the console:
Code:

man SomeCommand
end you can go out from man pressing 'q'... or you follow this tip or you're going to find many rtfm (Read The Fu... full Manual) if you know what I mean ;)


best rregards[]'s

newbiesforever 01-25-2009 11:34 AM

Quote:

Originally Posted by maginotjr (Post 3420326)
root is the God on your system but you always can try to hide something from him, like using some tool like EncFS that Encryptate any folder giving you the power to own the only key to open them (some password of course not a real key), at the same time root may seem an strange concept its the most powerfull concept on a unix system.

talking about chown and chmod I would sticky with jschiwal, use man, dont make so simple questions, realy. We notice that you are very new to linux and you have to learn first to search for the answers on the net or in the man pages.
Man pages are simple tu use you just need to type in the console:
Code:

man SomeCommand
end you can go out from man pressing 'q'... or you follow this tip or you're going to find many rtfm (Read The Fu... full Manual) if you know what I mean ;)


best rregards[]'s

:) Begging your pardon, but I'm not new to Linux. What I am is a 5 1/2 year-user with a comprehension level of an advanced newbie.

pixellany 01-25-2009 11:43 AM

Quote:

Originally Posted by newbiesforever (Post 3420771)
:) Begging your pardon, but I'm not new to Linux. What I am is a 5 1/2 year-user with a comprehension level of an advanced newbie.

Me too.....;)

Yes, he was talking down to you.......
No, you are not the only person to suddenly realize that root can do anything---including reading, changing, and deleting all you data......

No, you should not get upset......;)

newbiesforever 01-25-2009 12:17 PM

:) I wasn't upset.--I'm better at brushing off geek taunts than I used to be. Actually, I was well aware of the concept that root is God--that's newbie knowledge to me. My question was only about chowning.

And you can't mean you're an "advanced newbie," because how would you be a mod. Unless you were patronizing me, you must mean you've used Linux for 5 1/2 years. It seems impressive to have become an apparent expert in such a relatively short time.

pixellany 01-25-2009 05:22 PM

mod != expert

many posts != expert

Seriously, I think what I have learned in the last 3+ years at LQ is a bit about where to look for things. I really doubt that I would be employable in the IT industry---that I will leave to the folks ~ 1/3 my age.

I am also lucky to have learned some Unix and some programming before wandering down the Windows path for well over 5 years.

jiml8 01-25-2009 08:09 PM

Quote:

Originally Posted by renjithrajasekaran (Post 3419717)
So - You're telling me that an admin can simply chown any of the "restricted" files on my home folder and view them?

Seriously ???

Linux Archive

Yup. Root is the God in the Machine.


All times are GMT -5. The time now is 08:58 PM.