Permission error when "touch"ing file with different user


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Permission error when "touch"ing file with different user
# 1  
Old 01-18-2019
Permission error when "touch"ing file with different user

Hi,

There are 2 users (T886072 & T864764) that need to be provided full (rwx) access to a directory. I made the changes to the directory permissions using chmod and setfacl :

Code:
root@digidb2:[/root]# chmod 700 /u02/ftpfiles/MFRS16/discount_rates/
root@digidb2:[/root]# setfacl -s user::rwx,group::---,other:---,mask:rwx,user:T886072:rwx,user:T864764:rwx /u02/ftpfiles/MFRS16/discount_rates

This is how the directory permissions look after changes have been made :

Code:
root@digidb2:[/u02/ftpfiles/MFRS16/discount_rates]# ls -ld .
drwx------+  2 applprod other         96 Jan 18 11:21 .
root@digidb2:[/u02/ftpfiles/MFRS16/discount_rates]# getfacl .

# file: .
# owner: applprod
# group: other
user::rwx
user:T886072:rwx                #effective:rwx
user:T864764:rwx                #effective:rwx
group::---              #effective:---
mask:rwx
other:---
root@digidb2:[/u02/ftpfiles/MFRS16/discount_rates]#

With these permissions, the users are able to cd into the directory and touch files without problems. However, if I re-touch the same filename in the directory, I get the error below only for user T864764 .The other user (T886072) does not have this problem.

User T886072 :

Code:
bash-3.00$ id
uid=1331(T886072) gid=1(other)
bash-3.00$ pwd
/u02/ftpfiles/MFRS16/discount_rates
bash-3.00$ touch abc
bash-3.00$ ls -lrt
total 0
-rw-r--r--   1 T886072  other          0 Jan 18 14:34 abc
bash-3.00$ touch abc
bash-3.00$ ls -lrt
total 0
-rw-r--r--   1 T886072  other          0 Jan 18 14:34 abc
bash-3.00$ touch abc
bash-3.00$ ls -lrt
total 0
-rw-r--r--   1 T886072  other          0 Jan 18 14:35 abc
bash-3.00$ touch abc
bash-3.00$

User T864764 :

Code:
$ id
uid=1332(T864764) gid=1(other)
$ pwd
/u02/ftpfiles/MFRS16
$ bash
bash-3.00$ cd discount_rates/
bash-3.00$ pwd
/u02/ftpfiles/MFRS16/discount_rates
bash-3.00$ ls -lrt
total 0
-rw-r--r--   1 T886072  other          0 Jan 18 14:35 abc
bash-3.00$ touch abc
touch: cannot change times on abc: Permission denied
bash-3.00$ touch abc
touch: cannot change times on abc: Permission denied
bash-3.00$

Please help debug why this problem happens.
# 2  
Old 01-18-2019
User T864764 is not the owner of this file abc and cannot recreate it.
-rw-r--r--
Second user in the same group so you can only read it. r--
To change the file, you need to add permissions to this file from the first user.
-rw-rw-r--

--- Post updated at 08:35 ---

Or create another file
Code:
touch ABC

go to the first user and you also can not update the new file ABC.
These 2 Users Gave Thanks to nezabudka For This Post:
# 3  
Old 01-18-2019
Be aware that the title you chose for this thread ("Getting error when touch more than 1 instance of the same file") was somewhat misleading - I modified it for you, moved it to an adequate forum, edited the tags, and added the "solved" tag.
This User Gave Thanks to RudiC For This Post:
# 4  
Old 01-18-2019
Hi anaigini45,

you set extended permissions for the directory - but not for the files(You'l see that if you look at getfacl yourfile). The directory permissions are not inherited to the file. If you want to have it that way, you must set the extended permissions in some way.

Regards,
Stomp

--- Post updated at 12:53 PM ---
Anyway: You did not mention anything about your environment. Help could be more useful with details about that. My local version of setfacl does not support an -s option.

My setfacl here says it is possible to use the -d option to specify a default acl, which is used for any element, created in that directory. This may help you. Have a look into your manpage of setfacl.(I can not help you with other unices than linux here anyway).


Quote:
Originally Posted by RudiC
and added the "solved" tag.

To me this thread is not solved.

Last edited by stomp; 01-18-2019 at 08:08 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to run root level command , if user has "su -" permission in sudoers provided?

I am looking t run root level command on multiple servers, but all servers have only "su - " permission available in sudoers. please help me if any way that I can run command using help of "su -" My script for hosts in `cat hosts.txt`; do echo "###########################Server Name-... (5 Replies)
Discussion started by: yash_message
5 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. UNIX for Dummies Questions & Answers

What is the significance of sh -s in ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh?

Please can you help me understand the significance of providing arguments under sh -s in > ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh (4 Replies)
Discussion started by: Sree10
4 Replies

5. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. UNIX for Dummies Questions & Answers

changing password with sudo user " permission denied"

HI All, I am using solaris i created a user adam and updated his permissions in vi sudoers file as follows adam ALL=(ALL) NOPASSWORD: ALL ........... when i create user by logging as sudo user . $ sudo useradd -d /home/kalyan -m -s /bin/sh kalyan sudo: not found ... (6 Replies)
Discussion started by: kalyankalyan
6 Replies

8. Shell Programming and Scripting

Ignore "a line" within /etc/profile only when su'ing

Is there a way to ignore a command within /etc/profile only when su'ing as any particular user. For instance.... As root, if I run "su - oracle -c program" it is running a string in my profile called "echo "^2;$(hostname)-(ABC) @ $(who am i)^G". I don't want the above string to run if I... (9 Replies)
Discussion started by: lwif
9 Replies

9. UNIX for Advanced & Expert Users

Command similar to "touch" for modify File size

Hi All, I'm trying to find a command like similar to "touch" which would let me change the file size property. For ex: I have a file of size 1MB using the command i would like to set/update the size something like 1KB. Is it possible? Is there any such command which would accomplish this... (3 Replies)
Discussion started by: sriharshareddyk
3 Replies

10. UNIX for Dummies Questions & Answers

"vi"-ing a constantly updated file

Hi, A bit of a dumb question here. Sorry folks. Suppose I have this file which is being updated at irregular intervals (a few seconds, a few minutes, who knows) by a background process. I 'vi' this file with the intention of editing it, so it opens up a temp copy as the usual... (8 Replies)
Discussion started by: Percy
8 Replies
Login or Register to Ask a Question