Operating System - HP-UX
1826665 Members
2483 Online
109696 Solutions
New Discussion

permission denied and not owner erros

 
SOLVED
Go to solution
Ali KEMAL
Advisor

permission denied and not owner erros

Hi,

I restored some files on my HP-UX. After that
I tried to delete a few files. But I get the error "permission denied". So I wanted to change the file owner by "chown". This time I got the error "not owner".

In this case, How to delete the files.
Can anybody help me please? This is urgent for me.

Thanks,
Ali Kemal.
15 REPLIES 15
R.K. #
Honored Contributor

Re: permission denied and not owner erros

Hi Ali,

Give us few details:
1. # ll
2. Are you trying to delete it through root user?
3. To delete forcefully, you can try:
# rm -f

Regds,
R.K.
Don't fix what ain't broke
Dennis Handly
Acclaimed Contributor

Re: permission denied and not owner erros

To delete files you must have permission on the directory. So you would need to use "ll -d directory".

To change the owner, you have to be the owner and have PRIV_CHOWN in your group, setprivgrp(1M).

If you are root and the file isn't over NFS, you can also chown.
Suraj K Sankari
Honored Contributor

Re: permission denied and not owner erros

Hi,

Loggin as a root (Superuser) then you can change any files permission into the system.

Suraj
Bart Paulusse
Respected Contributor
Solution

Re: permission denied and not owner erros

Hi Ali,

if you are already logged on as root, then you are probably working an an nfs mount that was mounted anonymous. In that case user root will actualy be user Nobody on that nfs mount. To remove the files go to the exported directory instead of the nfs mount.

Regards,
Bart
Ali KEMAL
Advisor

Re: permission denied and not owner erros

Hi Bart,

Yes, it is an NFS on the server. I tried to delete files on a remote server and couldn't. After logging on the local server as root, I can delete and change the ownership but I can't set the owner of the file as nobody. I can see that the up directories' ownership seem as "nobody:sys" .

After the restore process from the backup unit, the restored files and directories' ownership become "root:root". So, how can change all the restored directories and files into their original states? That's, I want to set the ownership as "nobody:sys". Can you tell me how to corect this issue?

Thanks,
Ali KEMAL.
Dennis Handly
Acclaimed Contributor

Re: permission denied and not owner erros

>After the restore process from the backup unit, the restored files and directories' ownership become "root:root".

You have to restore the files on the server, not the client. Or you have to export the filesystem with the root as root option

>I want to set the ownership as "nobody:sys".

You can simply do a chown nobody, on the server.
Ali KEMAL
Advisor

Re: permission denied and not owner erros

Hi,

I restored files to their original location on the server not client.Also I had got an error "Cannot set owner: [22] Invalid argument" during the restore operation.

After that I could not change ownership to nobody:sys as before. But I change the ownership to another user (for example "ali") except nobody:sys.
In this manner I can not even copy the file on client site and I get the error "permission denied".

When I try to change owner on the server, the following error comes on the screen.

#chown nobody zztxt.txt
zztxt.txt: Invalid argument

I don't know what happens, because I am not good at Unix world.

Is there any suggestion.
Thanks,
Ali KEMAL.
Dennis Handly
Acclaimed Contributor

Re: permission denied and not owner erros

>I restored files to their original location on the server not client. Also I had got an error "Cannot set owner: [22] Invalid argument" during the restore operation.

Who is the original owner? That shouldn't be nobody, unless the file was created on a client.

>After that I could not change ownership to nobody:sys as before.

Is there an entry for nobody in /etc/passwd and what does it say?

>When I try to change owner on the server, the following error comes on the screen.
>#chown nobody zztxt.txt
zztxt.txt: Invalid argument

chown(2) says:
EINVAL Either owner or group is greater than or equal to UID_MAX, or is an illegal negative value.

So what is in /etc/passwd?
Ali KEMAL
Advisor

Re: permission denied and not owner erros

Hi,

There is a package "eypkg" including main directory "DR1" and "DR2" on the server SRV1. And I can reach DR1 and DR2 from another server SRV2 through the network.

I could copy and delete the files under DR1 before I restored from backup tape.
And the folder and files owner seem nobody:sys .
Only the restored files and folder owner is root:root .

I can copy and delete files under DR1 and DR2 whose owner is nobody:sys from console on SRV2 but
I can not copy and delete the restored files, whose owner becomes root:rootv from console on SRV2.

After this, I tried to change owner and I got the error I said before.

I don't think it is important but I had changed the password of root because of security needs.

Now, What I should do? I can't understand the logic of this case.

>So what is in /etc/passwd?
In the file "passwd"
nobody:*:-2:-2::/:

Thanks,
Ali KEMAL.
Dennis Handly
Acclaimed Contributor

Re: permission denied and not owner erros

>I can not copy and delete the restored files, whose owner becomes root:root from console on SRV2.

You can only do this if you export these filesystems with root as root. Otherwise you are nobody.

>I don't think it is important but I had changed the password of root because of security needs.

Right.

>What I should do? I can't understand the logic of this case.

Make all changes on the NFS server, not client. Or allow clients to be root.

>In the file "passwd" nobody:*:-2:-2::/:

That's the right value.
Ali KEMAL
Advisor

Re: permission denied and not owner erros

Hi,

1) I saw that I could change the group of the restored files and directories on the SRV1(server) but not the owner.

2) I restored the files to their original location from the tape by choosing SRV2(Client) as the target server. The restored files seem as nobody:root like the way I want to see, and I can also change the group to sys and to root back.
But I can't change the owner to nobody back after changing the owner to root on both server.

3) When I make an FTP connection to SRV2 and put a file into DR1 or DR2, the files seems as nobody:sys like the original state before the restore operation.

4) The result, I found out here, is that I need to restore files by SRV2 (client). Otherwise I will got error.

I don't have information about how to configure the file sharing system on HP-UX and how to run. Could you tell me how to find documents about it or give a few URL links in order to understand much more?

Thanks for your help,
Ali Kemal.
Dennis Handly
Acclaimed Contributor

Re: permission denied and not owner erros

>I don't have information about how to configure the file sharing system on HP-UX and how to run.

What OS version? 11.31 has different commands, share(1m) vs exportfs(1m).
Ali KEMAL
Advisor

Re: permission denied and not owner erros

Hi,

HP-UX B.11.23 U.

Thanks,
Ali KEMAL.
Dennis Handly
Acclaimed Contributor

Re: permission denied and not owner erros

>HP-UX B.11.23

You can use SAM to help set up your NFS.
Basically on your server you add your filesystem to the file /etc/exports with the appropriate export options.

Then on your NFS client, you can either use mount(1m) or add the entries to /etc/fstab.
Ali KEMAL
Advisor

Re: permission denied and not owner erros

Thanks everybody for your help,
Ali KEMAL.