Privileges problem UMASK Nautilus. CentOS 7.7 - centos7

I have a problem with the privileges of [files/folders] created by Nautilus. As a test I set the UMASK of my specific user to 0000:
[simone#MYPC:~] >cat /mnt/home/simone/.bashrc | grep mask
# User Umask Override
umask 0000
[simone#MYPC:~] >cat /mnt/home/simone/.bashrc
# $HOME/.bashrc
umask 0000
[simone#MYPC:~] >umask
000
When I write a file or folder passing from terminal I can do it with the required privileges:
[simone#MYPC:~/Desktop] >touch file1.txt
[simone#MYPC:~/Desktop] >mkdir Folder1
[simone#MYPC:~/Desktop] >ls -la
-rw-rw-rw-. 1 simone home 0 Mar 21 2022 file1.txt
drwxrwxrwx. 2 simone home 4096 Mar 21 2022 Folder1
But when I create a file (TextEditor) or folder through Nautilus, I get different privileges:
[simone#MYPC:~] >ls -lart /tmp
drwxr-xr-x. 1 simone home 0 Mar 18 10:04 FolderByNautilus
[simone#MYPC:~] > ls -la /tmp/fileNautilus.txt
-rw-r--r--. 1 simone home 5 Mar 11 2022 /tmp/fileNautilus.txt
I would like Nautilus or text editor to write with the mask 0000 leaving the same privileges with which my terminal writes

Related

When attemping to copy a dir from repo to container in workflow, it's as if COPY command did nothing

My repo:
/
dbt-action/
action.yml
Dockerfile
entrypoint.sh
dbt/
profiles.yml
My workflow step:
- name: Run DBT
uses: ./dbt-action
My Dockerfile:
FROM ghcr.io/dbt-labs/dbt-redshift:1.3.latest
COPY dbt .dbt
COPY entrypoint.sh /entrypoint.sh
My entrypoint:
!/bin/bash
pwd
ls -la
Outputs the following:
drwxr-xr-x 6 1001 123 4096 Jan 7 13:06 .
drwxr-xr-x 6 root root 4096 Jan 7 13:06 ..
drwxr-xr-x 8 1001 123 4096 Jan 7 13:06 .git
drwxr-xr-x 3 1001 123 4096 Jan 7 13:06 .github
drwxr-xr-x 3 1001 123 4096 Jan 7 13:06 blah
-rw-r--r-- 1 1001 123 1744 Jan 7 13:06 README.md
drwxr-xr-x 3 1001 123 4096 Jan 7 13:06 dbt-action
Expected output:
Same as above but with additional directory .dbt coming from COPY dbt .dbt in my Dockerfile.
Why don't I see dir .dbt when I ls -la in my entrypoint?
Seems like you are executing your ‘Docker build’ from the wrong working directory, since the ‘dbt-action’ folder is present, but not it contents. Can you double check the PWD before you build?

Invalid value for "path" parameter: no file exists at

As mentioned at Terraform Resource: Connection Error while executing apply
I changed my code to the the below
provisioner "remote-exec" {
connection {
type = "ssh"
host = aws_eip.nat-eip.public_ip
user = "ubuntu"
private_key = file("/id_rsa.pem")
}
inline = [
"chmod +x /tmp/start_node.sh",
"sudo sed -i -e 's/\r$//' /tmp/start_node.sh", # Remove the spurious CR characters.
"sudo /tmp/start_node.sh",
]
}
But I still get the same error
Error: Invalid function argument
on explorer.tf line 60, in resource "aws_instance" "explorer":
60: private_key = file("/id_rsa.pem")
Invalid value for "path" parameter: no file exists at /id_rsa.pem;
this function works only with files that are distributed as part of the
configuration source code, so if this file will be created by a resource in
this configuration you must instead obtain this result from an attribute of
that resource.
ls -la ooutput
total 156
drwxr-xr-x 10 CORP\mayuresh CORP\domain users 4096 Jan 12 14:29 .
drwxr-xr-x 16 CORP\mayuresh CORP\domain users 4096 Jan 10 13:10 ..
drwxr-xr-x 12 CORP\mayuresh CORP\domain users 4096 Jan 12 09:49 byoc-terraform
drwxr-xr-x 2 CORP\mayuresh CORP\domain users 4096 Jan 11 11:57 controllers
-rw-r--r-- 1 CORP\mayuresh CORP\domain users 188 Jan 10 13:27 .env
-rw-r--r-- 1 CORP\mayuresh CORP\domain users 1582 Jan 10 17:12 fetchUserData.js
drwxr-xr-x 9 CORP\mayuresh CORP\domain users 4096 Jan 12 13:14 .git
-rw-r--r-- 1 CORP\mayuresh CORP\domain users 629 Jan 10 13:27 .gitignore
-rw-r--r-- 1 CORP\mayuresh CORP\domain users 107 Dec 30 06:49 .gitmodules
-rw-r--r-- 1 CORP\mayuresh CORP\domain users 1765 Jan 12 13:21 id_rsa.pem
-rw-r--r-- 1 CORP\mayuresh CORP\domain users 1488 Jan 10 13:27 index.js
drwxr-xr-x 3 CORP\mayuresh CORP\domain users 4096 Jan 10 13:27 models
drwxr-xr-x 221 CORP\mayuresh CORP\domain users 12288 Jan 10 13:30 node_modules
-rw-r--r-- 1 CORP\mayuresh CORP\domain users 1058 Jan 10 13:27 package.json
-rw-r--r-- 1 CORP\mayuresh CORP\domain users 78791 Jan 10 13:27 package-lock.json
drwxr-xr-x 2 CORP\mayuresh CORP\domain users 4096 Jan 10 13:27 routes
drwxr-xr-x 2 CORP\mayuresh CORP\domain users 4096 Jan 10 17:01 utils
drwxr-xr-x 2 CORP\mayuresh CORP\domain users 4096 Jan 10 13:27 VMCreationFiles```
Have you tried using the full path? Especially beneficial if you are using modules.
I.E:
private_key = file("${path.module}/id_rsa.pem")
Or I think even this will work
private_key = file("./id_rsa.pem")
I believe your existing code is looking for the file at the root of your filesystem.
Your path to the .pem is wrong. It looks like the file exists in your $HOME directory.
You can provide the absolute path of the id_rsa.pem file if that file is outside of path.module, path.root, path.cwd
To provide the absolute path
Fetch the full path of the file How to get full path of a file?
Paste the path in:
provisioner "remote-exec" {
connection {
type = "ssh"
host = aws_eip.nat-eip.public_ip
user = "ubuntu"
private_key = file("<Absolute path to .pem file e.g /home/ubuntu/id_rsa.pem>")
}

GCP's SSH terminal not working after stopping and starting vm instance

I am using gcp vm machine instance N1-standard 8V-30GB and N1-standard 4V-15GB
os-Debian
version - Debian GNU/Linux 10(buster)
this issue i am facing from last 1 month.
public access permission denied is one of message i am seeing while trying to access from cloud shell
I had run command chmod 777 <home directory> earlier.
I've tried to reproduce your steps and was able to solve this issue.
Please have a look at my steps below:
create VM instances:
gcloud compute instances create instance-1 --zone=europe-west3-a --machine-type=e2-medium --image=ubuntu-1804-bionic-v20200701 --image-project=ubuntu-os-cloud
gcloud compute instances create instance-2 --zone=europe-west3-a --machine-type=e2-medium --image=ubuntu-1804-bionic-v20200701 --image-project=ubuntu-os-cloud
change permissions recursively on my home directory at the VM instance instance-1:
instance-1:~$ chmod -R 777 ~
instance-1:~$ ls -la
...
drwxrwxrwx 2 username username 4096 Jul 15 07:50 .ssh
create snapshot of the VM instance instance-1 boot disk:
gcloud compute disks snapshot instance-1 --snapshot-names instance-1-snapshot --zone=europe-west3-a
create a new disk with the snapshot:
gcloud compute disks create instance-1-snapshot-disk --zone=europe-west3-a --source-snapshot=instance-1-snapshot
attach created disk instance-1-snapshot-disk to the VM instance instance-2:
instance-2:~$ ls -l /dev/ | grep sd
brw-rw---- 1 root disk 8, 0 Jul 15 07:39 sda
brw-rw---- 1 root disk 8, 1 Jul 15 07:39 sda1
brw-rw---- 1 root disk 8, 14 Jul 15 07:39 sda14
brw-rw---- 1 root disk 8, 15 Jul 15 07:39 sda15
instance-2:~$ mount | grep sda
/dev/sda1 on / type ext4 (rw,relatime)
/dev/sda15 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
then
gcloud compute instances attach-disk instance-2 --disk=instance-1-snapshot-disk --zone=europe-west3-a
after that
instance-2:~$ ls -l /dev/ | grep sd
brw-rw---- 1 root disk 8, 0 Jul 15 07:39 sda
brw-rw---- 1 root disk 8, 1 Jul 15 07:39 sda1
brw-rw---- 1 root disk 8, 14 Jul 15 07:39 sda14
brw-rw---- 1 root disk 8, 15 Jul 15 07:39 sda15
brw-rw---- 1 root disk 8, 16 Jul 15 08:04 sdb
brw-rw---- 1 root disk 8, 17 Jul 15 08:04 sdb1
brw-rw---- 1 root disk 8, 30 Jul 15 08:04 sdb14
brw-rw---- 1 root disk 8, 31 Jul 15 08:04 sdb15
instance-2:~$ sudo mkdir /mnt/instance-1-snapshot-disk
instance-2:~$ sudo mount /dev/sdb1 /mnt/instance-1-snapshot-disk
instance-2:~$ ls -la /mnt/instance-1-snapshot-disk
total 104
drwxr-xr-x 23 root root 4096 Jul 15 07:56 .
drwxr-xr-x 3 root root 4096 Jul 15 08:05 ..
drwxr-xr-x 2 root root 4096 Jul 1 19:14 bin
drwxr-xr-x 4 root root 4096 Jul 1 19:19 boot
drwxr-xr-x 4 root root 4096 Jul 1 19:11 dev
drwxr-xr-x 93 root root 4096 Jul 15 07:55 etc
drwxr-xr-x 4 root root 4096 Jul 15 07:50 home
lrwxrwxrwx 1 root root 30 Jul 1 19:18 initrd.img -> boot/initrd.img-5.3.0-1030-gcp
lrwxrwxrwx 1 root root 30 Jul 1 19:18 initrd.img.old -> boot/initrd.img-5.3.0-1030-gcp
drwxr-xr-x 22 root root 4096 Jul 1 19:17 lib
drwxr-xr-x 2 root root 4096 Jul 1 19:01 lib64
drwx------ 2 root root 16384 Jul 1 19:13 lost+found
drwxr-xr-x 2 root root 4096 Jul 1 19:01 media
drwxr-xr-x 2 root root 4096 Jul 1 19:01 mnt
drwxr-xr-x 2 root root 4096 Jul 1 19:01 opt
drwxr-xr-x 2 root root 4096 Apr 24 2018 proc
drwx------ 3 root root 4096 Jul 15 07:36 root
drwxr-xr-x 4 root root 4096 Jul 1 19:19 run
drwxr-xr-x 2 root root 4096 Jul 1 19:17 sbin
drwxr-xr-x 6 root root 4096 Jul 15 07:36 snap
drwxr-xr-x 2 root root 4096 Jul 1 19:01 srv
drwxr-xr-x 2 root root 4096 Apr 24 2018 sys
drwxrwxrwt 7 root root 4096 Jul 15 07:56 tmp
drwxr-xr-x 10 root root 4096 Jul 1 19:01 usr
drwxr-xr-x 13 root root 4096 Jul 1 19:12 var
lrwxrwxrwx 1 root root 27 Jul 1 19:18 vmlinuz -> boot/vmlinuz-5.3.0-1030-gcp
lrwxrwxrwx 1 root root 27 Jul 1 19:18 vmlinuz.old -> boot/vmlinuz-5.3.0-1030-gcp
change permissions:
.ssh directory: 700 drwx------
public key (.pub file): 644 -rw-r--r--
private key (id_rsa): 600 -rw-------
lastly your home directory should not be writeable by the group or others: 755 drwxr-xr-x
instance-2:~$ chmod -R 755 /mnt/instance-1-snapshot-disk/home/username/
instance-2:~$ chmod -R 700 /mnt/instance-1-snapshot-disk/home/username/.ssh/
instance-2:~$ chmod 644 /mnt/instance-1-snapshot-disk/home/username/.ssh/authorized_keys
unmount the disk when you finish:
instance-2:~$ sudo umount /mnt/instance-1-snapshot-disk/
detach disk instance-1-snapshot-disk from the VM instance instance-2:
gcloud compute instances detach-disk instance-2 --disk=instance-1-snapshot-disk --zone=europe-west3-a
create a new instance from the repaired disk:
gcloud compute instances create instance-3 --zone=europe-west3-a --machine-type=e2-medium --disk=name=instance-1-snapshot-disk
check SSH connection to at the VM instance instance-1.
In addition, please have a look at the documentation Troubleshooting SSH section Inspect the VM instance without shutting it down to find more details.
From owner's account i tried to access instance-1 but owner is also not able to connect to the instance-1.
owner of project got this pop-up on ssh window
[1]: https://i.stack.imgur.com/y2fzC.jpg
I observe that in fresh new created instance if i add add some file like git clone repo, after that if i restart it then i am able to connect SSH again.

pip install ansible directory owner error

When trying to sudo pip install ansible on mac OS 10.12 I get the error:
The directory '/Users/myuser/Library/Caches/pip/http' or its
parent directory is not owned by the current user and the cache has
been disabled. Please check the permissions and owner of that
directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/myuser/Library/Caches/pip' or its parent
directory is not owned by the current user and caching wheels has been
disabled. check the permissions and owner of that directory. If
executing pip with sudo, you may want sudo's -H flag.
I checked the owner of the current and listed directories using ls -l and they are all the same. (The first ls is the parent directory of website where I am trying to run the install)
My-Mac:Artivest myuser$ ls -l
total 0
drwxr-xr-x 9 myuser staff 306 Jul 23 11:12 developer_tools
drwxr-xr-x 2 myuser staff 68 Jul 23 11:32 modules
drwxr-xr-x 3 myuser staff 102 Jul 23 11:29 virtualbox-images
drwxr-xr-x 54 myuser staff 1836 Jul 23 11:48 website
My-Mac:Artivest myuser$ cd /Users/myuser/Library/Caches/pip
My-Mac:pip myuser$ ls -l
total 8
drwx------ 8 myuser staff 272 Jul 23 12:20 http
-rw-r--r-- 1 myuser staff 113 Jul 23 11:00 selfcheck.json
My-Mac:pip myuser$ cd /Users/myuser/Library/Caches/pip/http
My-Mac:http myuser$ ls -l
total 0
drwx------ 3 myuser staff 102 Jul 23 12:20 1
drwx------ 3 myuser staff 102 Jul 23 11:00 9
drwx------ 5 myuser staff 170 Jul 23 12:20 a
drwx------ 3 myuser staff 102 Jul 23 11:00 b
drwx------ 3 myuser staff 102 Jul 23 12:20 e
drwx------ 3 myuser staff 102 Jul 23 11:00 f
My-Mac:http myuser$
How can I get past this error?
First I would suggest installing python using brew, then you could try:
$ pip install --upgrade --user ansible
This will install ansible within your $HOME if using python 3 it will be in /Library/Python/3.7/bin or if using python 2 in ~/Library/Python/2.7/bin

Program deleting file of other user - permission denied

I have two Users. User1 is running a program which tries to delete a file from user2. But my program always return me "permission denied".
When I try to delete the file myself as user1 with the rm command there is no problem. The permission of the files are 775 and my user1 is in the group of user2. This group is also the owner of the files. The permission of the directory in which the files are is 775 too.
For removing the file the program I have written uses the "remove" function from c/c++.
Does anyone have a solution or idea ?
I have asked this question on unix.stackexchange.com before. They have sent me here.
Here is my code:
void deleteFile()
{
if(0 != remove("File1.txt"))
cout<<"Error deleting File: "<<strerror(errno)<<endl;
if(0 != remove("File2.txt"))
cout<<"Error deleting File: "<<strerror(errno)<<endl;
}
i have renamed the files but i know the original paths are correct. i have already tested this
more information:
ok i have runnned the program as user2 and the files have been deleted without any problems.
groups user1
users user2
groups user2
user2 adm www-data plugdev users ftp vsftpd
ls -lah
drwxrwxr-x 7 user2 user2 4.0K Nov 27 14:13 .
drwxrw-r-x 4 user2 user2 4.0K Nov 11 12:34 ..
-rwxrwxr-x 1 user2 user2 50 Nov 12 15:12 File1.txt
-rwxrwxr-x 1 user2 user2 826 Nov 27 14:13 File2.txt
I did a test, below, which demonstrates that to delete a file, a user needs to have write permission for the directory which contains the file. According to your output from "ls -l" your user2 should be permitted to delete (remove) the file.
Your code example does not compile. Can you provide a complete code example that demonstrates your problem? The simple program below behaves as expected. You might try your test with this simpler example:
#include <stdio.h>
int main()
{
printf("result: %i\n", remove("/home/user1/delete_me"));
}
I think your problem is not related to file permissions.
newf:~# groups user1
user1 : user1
newf:~# groups user2
user2 : user2 user1
newf:~# su - user1
$ date > delete_me
$ chmod g+w delete_me
$ exit
newf:~# su - user2
$ ls -la ~user1
total 12
drwxr-xr-x 2 user1 user1 4096 Nov 28 13:27 .
drwxr-xr-x 8 root root 4096 Nov 28 13:19 ..
-rw-rw-r-- 1 user1 user1 29 Nov 28 13:28 delete_me
$ date >> ~user1/delete_me
$ cat ~user1/delete_me
Fri Nov 28 13:28:44 EST 2014
Fri Nov 28 13:31:39 EST 2014
$ rm ~user1/delete_me
rm: cannot remove ‘/home/user1/delete_me’: Permission denied
$ exit
newf:~# su - user1
$ chmod g+w .
$ exit
newf:~# su - user2
$ ls -la ~user1
total 12
drwxrwxr-x 2 user1 user1 4096 Nov 28 13:27 .
drwxr-xr-x 8 root root 4096 Nov 28 13:19 ..
-rw-rw-r-- 1 user1 user1 58 Nov 28 13:31 delete_me
$ rm ~user1/delete_me
$ ls -la ~user1
total 8
drwxrwxr-x 2 user1 user1 4096 Nov 28 13:32 .
drwxr-xr-x 8 root root 4096 Nov 28 13:19 ..
You are not using remove correctly. It is simply:
remove("File1.txt")
instead of
remove(("File1.txt").c_str())
which when compiling results in the error:
error: request for member ‘c_str’ in ‘("File1.txt")’, which is of non-class type ‘const char [10]’
For error checking:
if(remove("File1.txt") == -1)
error occurred