Operating System - Linux
1752734 Members
5240 Online
108789 Solutions
New Discussion юеВ

Re: Cannot chown as a user

 
SOLVED
Go to solution
Mark Grant
Honored Contributor

Re: Cannot chown as a user

Assuming it doesn't matter which directory this file is created in for a moment. I think it's time to look at NIS.

I don't think reiserfs is your problems here. I would make sure you don't have your user name in /etc/passwd and in the NIS maps, perhaps with different UID's
Never preceed any demonstration with anything more predictive than "watch this"
Michael Williams_6
Trusted Contributor

Re: Cannot chown as a user

Oooh you're good, I've just su'd to a local user and tried the whole thing again and it appears to work.

Is there some PAM modifications I need to make regarding NIS and chown or something?

Anyone know?!?
Mark Grant
Honored Contributor

Re: Cannot chown as a user

I don't think PAM is your problem, especially if you can log in and everything. My guess is that your user in NIS has a different UID that the one in /etc/passwd.

Been a while since I "did" NIS but a believe "ypcat passwd | grep " should give you the user id that the NIS maps have and "grep /etc/passwd" should show you the name in /etc/passwd.

To be honest, you shouldn't have the user name in both so another solution may be to remove your user and see if you can still log in and everything starts working again. OF COURSE, remember that if you can't log in, you will need another account to get yourself working again.
Never preceed any demonstration with anything more predictive than "watch this"
Olivier Drouin
Trusted Contributor
Solution

Re: Cannot chown as a user

If I remember correctly, the thinkind behind the "a normal user cant chown any file" is that it would allow a user to bypass the disk quotas...
Yong_7
Frequent Advisor

Re: Cannot chown as a user

Hi Guys,

I'm with Olivier.

Generally, we can't "chown" our own files to others except we are "root accounts" on any unix-like system.

this is system security sense that prevent things happening like people throw "snow ball" ( your files) to each other.

if your are planing file xfer within your group. group permission setting is your Friends. hence, you may let us know what function/capability you are looking for ( file sharing ? ). people here definitely have a lot hints for your reference.

Cheers !

YJ
Alexander Chuzhoy
Honored Contributor

Re: Cannot chown as a user

Then Yong is probably with me also...

The only reason Michael could chown his file-is because he already ran the SUID command on /bin/chown.
Michael Williams_6
Trusted Contributor

Re: Cannot chown as a user

Hi guys thanks for your help! After enough digging I was able to confirm that chown is priviliged only for root for security reasons.

e.g. create yourself a set-uid script and chown it to root and you've got a problem on your hands!

We've done a work-around to our problem by using groups and the chgrp command to achieve what we need!