System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: touch command is not working

 
SOLVED
Go to solution
Dennis Handly
Acclaimed Contributor

Re: touch command is not working

>Bill: you CANNOT touch a file (either create or change timestamps) unless the directory (NOT the file) allow you to write (which means change) the directory.

This is partially incorrect. You can change the timestamp on the file if you have write permission on the file.

>Mark: cd ..
>ll -d dirname
>2. Go back into the directory

No need to do cd twice. Simply:
ll -d .

>Volkmar: whoami -> gives your user name

id(1) also gives you your user and group IDs.

>Maybe there's no time zone defined for the user?

Not hardly. It refers to permission problems changing the time to "now".
~sesh
Esteemed Contributor

Re: touch command is not working

The problem is with the file / directory permissions. First thing to check would be whether write permission is available for the user who is logged in.

It should be "drwx", if "w" is missing you cannot create / modify anything in that directory. If you are sure to have user have write permissions use the chown command. Refer the manpage at:
http://docs.hp.com/en/B3921-90010/chown.1.html
V. Nyga
Honored Contributor

Re: touch command is not working

>Dennis: Not hardly. It refers to permission problems changing the time to "now".

ok Anjaneyulu, that means for your question:
>$ touch a
>touch: cannot change times on a

The file 'a' exists, but you don't have write permissions to this file.

Volkmar
*** Say 'Thanks' with Kudos ***
Dennis Handly
Acclaimed Contributor

Re: touch command is not working

>Volkmar: The file 'a' exists, but you don't have write permissions to this file.

Didn't Mark and I say that? :-)
V. Nyga
Honored Contributor

Re: touch command is not working

>Dennis: Ah nooo, Mark and you didn't say that the file 'a' have to exists to get this message .... :-)

Maybe it was quite obvious for you?
For me it was new so I had to test it :-)

V.
*** Say 'Thanks' with Kudos ***