1831672 Members
2016 Online
110029 Solutions
New Discussion

Re: chown

 
Tarek
Super Advisor

chown

Hi,
this problem seem very stupid (and of course it is!!), but i'm not able to change the owner of a directory!!!
Command used
chown -R user:group filename
I have
chown: filename: bad argument
what's wrong? I also checked the man pages but without any result.
Thanks
7 REPLIES 7
Marcin Golembski_1
Honored Contributor

Re: chown

Hi,

What is the filename? Is it a directory name? Try:

chown -R user:group filename/*

Marcin
Tarek
Super Advisor

Re: chown

The filename is a directory. I have created user tarek and i'm setting the permissions and owner. Chmod works, chown no.
Directory is: /home/tarek
command i'm using: chown -R tarek:users /home/tarek but it doesn't work.
i also tried /home/tarek/* but it says file or directory does not exist.
Any further help??
Marcin Golembski_1
Honored Contributor

Re: chown

Are you root?
Does chgrp -R :users /home/tarek work?
What are /home permissions?
Did you try on some other directory?
Tarek
Super Advisor

Re: chown

chgrp -R users /home/tarek works
/home/tarek permissions are 755
chown -R tarek /home/tarek still have error:
chown: /home/tarek: bad argument
thanks...
Marcin Golembski_1
Honored Contributor

Re: chown

Check /etc/passwd for missing or misspelled user tarek. If it's OK try on other directory and/or use different users and groups. I suspect your chown binary may be broken...
Tarek
Super Advisor

Re: chown

I have recreated user tarek. I don't know why it wasn't working. Now it's ok, don't ask me why.. i have created the user in the same mode. Thanks however for your help.
Tarek
Marco Paganini
Respected Contributor

Re: chown

Hi,

Just remember that you CANNOT change the ownership of a file that does not belong to you (unless you're root).

Try to login as root and...

chown -R tarek /home/tarek/*

Regards,
Paga
Keeping alive, until I die.