Closed Aethenn closed 8 months ago
While our script has no need to write to the file I do wonder why you are having this issue when no one else has.
What does
stat /etc/passwd
say?
Output of stat /etc/passwd :
File: /etc/passwd Size: 1552 Blocks: 8 IO Block: 4096 regular file Device: fd02h/64770d Inode: 146605005 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2023-10-16 12:04:46.966350181 +0200 Modify: 2022-03-23 11:37:06.866904770 +0100 Change: 2022-03-23 11:37:06.886904816 +0100 Birth: -
That looks fine, how are you running the Saltbox command?
Like usual : sb install backup
Is your sudo broken?
The reason I ask is that sb normally auto elevates to running as root through sudo.
I think not
Well, root has write access and you cannot open it, that would make me worry about other issues here.
When i sudo the script manually it works, I'm going to find my problem.
Write to me on the discord if you are on it. I'll submit my own changes to the script through this PR so you at least get credit for getting me to rewrite the old stuff.
I've added my own changes to the facts files but you should still find out what caused this as it isn't what is supposed to happen :)
Description
After deploying the backup role, i see the Gathering Facts task on the warning.
TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************************************************** Monday 16 October 2023 23:01:51 +0200 (0:00:00.436) 0:00:00.436 ******** [WARNING]: Failure executing fact script (/srv/git/saltbox/ansible_facts.d/group.fact), rc: 1, err: Traceback (most recent call last): File "/srv/git/saltbox/ansible_facts.d/group.fact", line 6, in <module> file = open("/etc/group", "r+") PermissionError: [Errno 13] Permission denied: '/etc/group' [WARNING]: Failure executing fact script (/srv/git/saltbox/ansible_facts.d/user.fact), rc: 1, err: Traceback (most recent call last): File "/srv/git/saltbox/ansible_facts.d/user.fact", line 6, in <module> file = open("/etc/passwd", "r+") PermissionError: [Errno 13] Permission denied: '/etc/passwd'
After checking the script, I saw the open() function defined with "r+". I set it to "r" and it works.
How Has This Been Tested?