I just installed lamp-server^ on my home linux machine.
Now I created a new folder project with files in the /var/www/ directory (server root directory). I set the owner user/group to www-data via sudo.
Now I want to access the folder and its files via cd or normally via the file explorer, but I get the error that I haven't the permission to do/access that folder or its files (with my normal user account).
Is it possible to give my user account the rights to access/modify the project folder?
you can either
a+rwx the directory or
include yourself in that group, but from your question, it seems you don't want to do that. it would be more secure than allowing anyone to read, write and execute that dir.
Yes it is possible. Just add your user in www-data group.
useradd -G www-data {your_username}
Related
Jenkins was running all fine on a RedHat Linux machine (a clean EC2 machine on AWS), until I decided to change the JENKINS_HOME. I simply moved the Jenkins directory from /var/lib/jenkins to /home/ec2-user/jenkins and then created a symlink. (I followed the first answer to this question: Change JENKINS_HOME on Red Hat Linux?).
However when I restart Jenkins I get the error:
Unable to create the home directory ‘/var/lib/jenkins’. This is most
likely a permission problem. To change the home directory, use
JENKINS_HOME environment variable or set the JENKINS_HOME system
property.
I tried changing JENKINS_HOME in /etc/sysconfig/jenkins, setting it to the new folder (which I suppose defeats the point of a symlink?) and I still get the same error
Unable to create the home directory ‘/home/ec2-user/jenkins’.
It is for backup purposes, so that I have all Jenkins data in a mounted external data storage (AWS Elastic File System).
I've figured it out. This error was persisting because the /jenkins/ folder needs to be accessible to user 'jenkins' to run processes, but it couldn't access this folder because it is belongs to the particular logged in user. I changed the mounting to /var/ where jenkins can access as global process, and it solved the problem.
I ran into the same problem, so sharing my solution here:
The user jenkins does not have access to the folder home/ec2-user/jenkins. You can modify the access rights of the folder home/ec2-user/home by changing or adding the user jenkins to owner
sudo chown jenkins /home/ec2-user/jenkins
sudo chmod u+w /home/ec2-user/jenkins
To verify the new ownership, you can do:
ls -ld /home/ec2-user/jenkins
The error seems pretty obvious: "This is most likely a permission problem."
I assume /home/jenkins does not exists, and the user jenkins does not have write permissions in /home. If you moved the Jenkins home, then you probably did it as root and just forgot to update owner permissions.
You would need to create the home, something like this:
sudo service jenkins stop
# make the changes in /etc/sysconfig/jenkins
sudo mkdir --parents /home/jenkins # or mv, in your case
sudo chown --recursive jenkins /home/jenkins
sudo service jenkins start
I have a mysql instance that needs to dump csv files into a jenkins workspace. Unfortunately, Jenkins has permissions 755 for the workspace directory, and I need to be able to create and delete jobs of this type very often, so manual configuration doesn't work. How do I change the default permissions on these directories without writing a script do do it?
Just change the permissions on the root workspace directory. The workspaces for each job will be in subdirectories underneath the root, so they will inherit the root directory's permissions.
chown -R jenkins_user:jenkins_group /path_to_workspace_root
i m working on ubuntu and just installed lamp.As i m new to linux i m not sure how to create a directory or file under /var/www of lamp server to start working on my website project
Under *nix you can create a directory using mkdir newdirname and you can create a new and empty file, using touch newfilename. Those are commands you need to execute from a shell/terminal. In order to get to /var/www, you will need to cd /var/www.
If you are new to Linux I suggest reading any guide on basic like this or this.
Chances are you do not have sufficient privileges as your normal user to add files or create directories. You can either change the ownership of the /var/www directory (and everything within) or you can sudo each one you want to add.
From the prompt: chown [your_user_name].users -R /var/www
Then you can mkdir [directory name] to make a directory or touch [filename] to create a file.
If you do not change the permissions of the /var/www you may need to put sudo in front of each of the above commands (will be prompted for password)
I'm having trouble setting up my svn. I used apt-get install subversion to install the software. The default svn folder was /home/svn/ I changed the ownership of the folder to an administrator account (not root) and a subversion user group I setup. I set the folder permissions to 0760 recursively through all the subfolders.
Yet whenever I try connecting to the repo I get this: "Commit failed (details follow):
Can't open file '/home/svn/bftc/format': Permission denied".
I have no idea what's wrong!
Make sure your user has execute permission on any folder. 770 should work for you (as Newton Falls pointed out) as this will allow group execute.
If your svn repository is owned by a group that you are not in, then 770 will not work. You have to be part of the group, or change permissions to 777. The former is preferable.
How have you set up the repository access? Does your user have permissions to access your repository? If it is via the svn access file you may want to check the user permissions.
I'm writing an install script in bash for an application on Linux.
This script copies some files into /usr/bin and /usr/share, so it needs to be executed by a root user, furthermore it makes an hidden directory in the $HOME dir for configuration files.
Here is the problem: if a normal user wants to install the program, he needs to be root. But if he is root, the $HOME directory will be /root/ instead of /home/username.
...and, further, if UserA installs the software, but UserB runs it, UserB won't have the hidden directory under /home/UserB. Also, the hidden directory under /home/UserA will be owned by root, not userA.
So, you need to have the application create the hidden directory, not the installer.
Another possible option is not to install in the system directories; one possible alternative location is /usr/local. However, even that can require root privileges. Think about whether it can be installed in other places, and how it could locate its materials.
However, requiring root privileges to install is not the end of the world - a nuisance for some, but not completely out of order. But requiring everyone who uses to have root privileges is way out of order - and if everyone who uses it needs to run the installer, that is bad.
Final point (for now): if you use sudo, it does not change the value of $HOME, even as you acquire root privileges. However, requiring everyone who uses your application to have sudo privileges is not a good thing either.
Must you use $HOME? Maybe you could prompt for the username and install to ~$username instead?