touch -t time, using different userid


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers touch -t time, using different userid
# 1  
Old 02-01-2010
touch -t time, using different userid

Hi,
I am reciveing files from a remote system on my linux box. These files are named based on time, which I can use to 'touch' the time .

I can access/modify these files using my id. but when I tried touching time using my id I am getting error;
Code:
touch -t 1001261234 1001261234_job2333
touch: setting times of `1001261234_job2333': Operation not permitted

My question is - Is it possible to touch a file with a different user? Any other changes that i can make to get this done?

The two users have following group access
my id
uid=2006208(ab00) gid=2005275(ab) groups=2005275(ab)

creator of the file
uid=2006208(xb00) gid=2005275(ab) groups=2005275(ab)

file permissions:
-rwxrwxr-x 1 xb00 ab 7 Feb 1 11:51 1001261234_job2333

Also, i have tried touch using the sender's id and they are working fine with that.

Looked into forum and googled it as well .. but no lcuk

Last edited by vbe; 02-01-2010 at 09:39 AM.. Reason: use code tags please (not color...)
# 2  
Old 02-01-2010
Your ab00 account has the same UID as xb00?
The fact that the file is group writable by the group your account abd the xb00 account are members of means you not have to own the file to change it so your ab00 account can have a separate UID to the xb00 account.

What are the permissions of the directory these files are in please? e.g. run:
Code:
$ ls -ld .

# 3  
Old 02-01-2010
TonyFullerMalv is right. You should be able to do so. Try touching non-existing file in the same dir first. This have to work as well. I can't see any other reason for this not working other than parent dir ownership or the bad implementation of unix permission system.
# 4  
Old 02-02-2010
here is what i got...

Code:
 
drwxrwxrwx  2 dev ab 1024 Jan 27 15:37 .


creator of the file
uid=2005782(xb00) gid=2005275(ab) groups=2005275(ab)

my id
uid=7780097(ab00) gid=2005275(ab) groups=2005275(ab)
# 5  
Old 02-02-2010
See my post: https://www.unix.com/tips-tutorials/1...rmissions.html
Last sentence:

Quote:
When the touch command is used to change the timestamps of an existing file, it invokes either the old utime() or the new utimes() system call. To change the timestamp on an existing file, you must own the file or be root. Also, you must have write permission on the file or be root.
# 6  
Old 02-02-2010
"Also"? So you have to be both owner and have write permissions? This seems ... a wrong design.
# 7  
Old 02-02-2010
Quote:
Originally Posted by dpc.ucore.info
"Also"? So you have to be both owner and have write permissions? This seems ... a wrong design.
Why? If you're not the owner of a file, it should by default be prohibited for you to change it. And even if you're the owner, you might want to protect it from accidental changes by removing your own write permission (you can add it again at any time, after all).
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Touch - changing date and time

Hi, I am facing a problem with the command - TOUCH on Linux. See the example below: File on Linux: rw-rw-r-- user1 user1 Jan 01 09:00 test.txt The file - test.txt was created by the user - user1. Now, I want to change the date and time, but using other user - user2 The user2... (12 Replies)
Discussion started by: brjohnsmith
12 Replies

2. UNIX for Advanced & Expert Users

Help with touch: bad time specification

Here is the part of the script: I have modified the file name.:) SSFILE=${My_HOME_DIR}/log/my_file_ss.log export MM=`date '+%m'` export DD=`date '+%d'` export HH=`date '+%H'` export MIN=`date '+%M'` export HOURAGO=`echo ${HH} -1 |bc ` echo $HOURAGO export TTIME=${MM}${DD}${HOURAGO}00... (5 Replies)
Discussion started by: N1a_Raider
5 Replies

3. Shell Programming and Scripting

How to change time stamp with touch command?

Hi, I wish to change time stamp of a directory with all its subdirectories and files on server. I am able to find following two ways but want to know which will be the better one. I have not tried anyone of them because I am not sure if it can effect my data: find * -type d -exec touch... (5 Replies)
Discussion started by: bioinfo
5 Replies

4. UNIX for Dummies Questions & Answers

userid and pw

questions: a. where can I customized the password of userid in solaris? say I wanted 10digits long, all caps? thanks (4 Replies)
Discussion started by: lhareigh890
4 Replies

5. Shell Programming and Scripting

What is the command to get name associated with userid?

Hi, 1#what is the command to get name associated with userid? 2#I am using unix on Mainframes thru OMVS. So any one know to to capture TSO command output to a variable on OMVS environment. I tried with below script, but its not working! #!/bin/ksh output=$(tso whois PA1234) echo... (6 Replies)
Discussion started by: prashant43
6 Replies

6. Red Hat

userid with nothing to do on the os/app

Hi All, I got this userid apache with the same userid and groupid and /sbin/nologin and the /www/a home folder is empty. Can I just delete this userid? How can I investigate if userid have something to do with the application? Thanks for any comment you may add. (1 Reply)
Discussion started by: itik
1 Replies

7. Shell Programming and Scripting

how to make a log.txt and add date and time when use ls,touch and find

Hey guy, how to make the log.txt file and record date and time when ls, touch and find command run? Thanks Boly (13 Replies)
Discussion started by: chenboly
13 Replies

8. UNIX for Dummies Questions & Answers

Touch all files and subdirectories (recursive touch)

I have a folder with many subdirectories and i need to set the modified date to today for everything in it. Please help, thanks! I tried something i found online, find . -print0 | xargs -r0 touch but I got the error: xargs: illegal option -- r (5 Replies)
Discussion started by: glev2005
5 Replies

9. Shell Programming and Scripting

how to touch a file with prev time stamp

i want to find the files which are modified in last 30 to 120 minutes i am using "find . -mmin +30 -mmin -120 " it is giving me the error find: bad option -mmin find: path-list predicate-list can somebody help me out . Thank you (5 Replies)
Discussion started by: Prat007
5 Replies

10. UNIX for Advanced & Expert Users

userid

I would like to know the difference between the real user-id and the effective user-id. If user-A runs a program owned by user-B then which is the real user-id and which is the effective user-id ? (1 Reply)
Discussion started by: sundaresh
1 Replies
Login or Register to Ask a Question