Linux file permissions outside home - linux

I want to create files and directories in a directory outside my home directory (on a different physical drive as I'm running out of space on my main drive). However I'm getting files with different permissions when I create them in a directory outside home which causes permission denied errors when I later execute some commands on these files I created.
I would like to use the directory outside my home (which is on different drive) in the same way as my home directory. How to do it?
To be specific, I'm following this manual http://project-magpie.github.io/yocto/2014/09/26/building-a-yocto-image-for-the-a20-olinuxino-lime/ but when executing "source oe-init-build-env ../build/a20-lime" command I'm getting permission denied error when I work in a directory outside my home on different drive.
When I work in my home I get no permission denied errors.

Related

Unable to create / edit files as non-root through Samba mount

I'm trying to setup a code-server (vscode in browser) instance and read/write from a mounted samba share. Unfortunately when I try to add a file it gives me an error that I do not have permissions to read/write to that folder. When I try to add files with the same credentials on Windows it does work though. This is the error that VSCode gives me:
Unable to write file
'vscode-remote://localhost:8080/home/user/repository/test'
(NoPermissions (FileSystemError): Error: EACCES: permission denied,
open '/home/gmetitieri/user/test')
If I sudo touch file.txt then the file will be created and added. I already used chmod and added full access to the folder but it still won't work. Is this a credentials thing or am I missing something?
I already tried this answer but it still doesn't let me write as non-root
Edit: This is the command I used to mount the drive (just with different folder names and IP address):
sudo mount -t cifs -o rw,vers=3.0,credentials=/root/.examplecredentials //192.168.18.112/sharedDir /media/share
Considering "non-root through Samba", especially in new releases of OpenSuse (...15.3 -- 15.4), I do few movements into normal configuration panels (no sudo commands or anything technical).
Using Yast Firewall section -- For now (immediate solution):
I turn off the firewall, then see what you can turn on (after this) to keep the samba working with Microsoft Windows.
More details on how to do this with images on my website.
This happens when the directory on the Samba share does not have permission for non-root users.
In your smb4.conf file:
[test]
comment = Test share
path = /path/to/directory
force user = unixuser
valid users = sambauser
In this example, unixuser should be the owner of the files in /path/to/directory. The user logged into Samba in this example is a user called sambauser.

Is execute permisson required in uploading file by scp?

I created a web application directory and app in the directory.
And, they have 776 permission and their group is apache:apache.
I'd like to allow others to upload modules by scp.
But,I want others not to execute programs.So,I don't give "x" others , but it doesn't work. They cant upload file and permisson denied.others group is "xxx".
I think if others have read and write permission , they can upload file. What is wrong?
In order to add files to a directory you need both write (+w) and execute (+x) permissions.
See this answer for how file permissions work in Linux:
https://unix.stackexchange.com/questions/21251/execute-vs-read-bit-how-do-directory-permissions-in-linux-work
The execute permission on a directory does not imply files in that directory are made executable.

permission denied while copying eventhough necessary permission exist

I have a file(file) with permission 500. In Linux, I tried to copy (using cp) that file into a folder (a) whose permission is 600. Even though folder have write permission, I am getting " cannot stat `a/file': Permission denied error.
Could anyone explain why is it so?
Is it because directory does not have executable permission ?
Execute bit allows the affected user to enter the directory, and access files and directories inside.
Plse see http://www.hackinglinuxexposed.com/articles/20030424.html
https://unix.stackexchange.com/questions/21251/why-do-directories-need-the-executable-x-permission-to-be-opened for further info

Allowing jenkins to access contents of currently logged in user folder

I am using Jenkins to build my project in a Linux machine. During build operation files are read from a source location and files are to be copied to a new destination location.The source and destination locations are input by the user from Jenkins UI. I want the user to be able to select any folder located within his/her home folder as source or destination. For example: /home/jdoe/folder.
Currently, any folder inside /var/lib/jenkins, with jenkins:nogroup user-group, can be selected. However, a folder inside /home/jdoe/folder with same (jenkins:nogroup) user-group, and with the same permissions as the folders within /var/lib/jenkins, cannot be selected. I get a permission denied error on trying to read or write inside /home/jdoe/folder.
What can I do to enable reading and writing to a folder within the home folder of the currently logged in user? Can I set up Jenkins in a certain way to be able to do that, or do I have to change group settings for the home folder?Could you suggest a good configuration for me to be able to make this work?
Would there be any difference in using Jenkins on an Windows platform?
First make sure that the folder is having read-write access for jenkins user group.
sudo chmod -R 77 /home/jdoe
Also as in comment by Daniel, grant execute permission on the /home/jdoe folder.
sudo chmod a+x /home/jdoe

How to allow file uploading outside home directory with SSH?

I'm running a Fedora 8 Core server. SSH is enabled and I can login with Transmit (FTP client) on port 22. When logged in, I can successfully upload files to the users home directory. Outside the home directory I can only browse files, not upload/change anything. How can I allow file uploading to a specific directory outside the users home directory?
an easy method is to grant the user rights to the folder you want them to be able to upload to, then add a symlink (link -s) from their home folder to the destination.
You can also just use
scp file user#server:/path
which will let you upload to any directory you have permissions to
file is the file to copy
user & server should be obvious
/path is any destination path on the server which you have rights to; so /home/user/ would be your likely default home folder
You need to make those directories writable by the proper users, or (easier) that user's group. This is of course a huge security hole, so be careful.
HI,
Give the FTP user write permission on the directory where you want to upload your files.

Resources