I'm createing an amazon ec2 server for the first time. I installed rvm as my ubuntu user in my ubuntu instance and created a deploy user for my rails app. But when I login as deploy user and move to my code folder I end up with below error
mkdir: cannot create directory ‘/usr/local/rvm/gems/ruby-2.1.5#myapp: Permission denied
Googled but couldn't understand. Can someone suggest me the solution for this please.
Fixed it by adding the user to rvm group.
Related
I'm doing a tutorial to learn more about adminsys and services on linux. I arrived to a chapter about Tomcat and Jenkins. It's about installing jenkins as a Tomcat servlet. I was following the instructions and I ran into trouble when I tried to change Jenkins default configuration directory like advised in the tutorial.
Ok so I first installed tomcat alone and the default web page showed up like expected at http://www.example.com:8080/
I downloaded jenkins using : wget https://get.jenkins.io/war-stable/2.361.2/jenkins.war
I moved the .war file in /var/lib/tomcat9/webapps using : sudo mv jenkins.war /var/lib/tomcat9/webapps
Now it's where it gets tricky : the tutorial says that Jenkins puts the configurations, logs and builds files in /root/.jenkins/ by default and advises to change that to put them in /var/lib/jenkins/.
To do that, I first created the directory : sudo mkdir /var/lib/jenkins
I changed the permissions so that tomcat can access it, using : sudo chown tomcat:tomcat /var/lib/jenkins
I went into /etc/tomcat9/context.xml . And I added inside the <Context /> tags :
<Context>
...
<Environment name=”JENKINS_HOME” value=”/var/lib/jenkins” type=”java.lang.String” />
</Context>
I edited tomcat service file /lib/systemd/system/tomcat9.service to avoid read and write problems for jenkins by adding in the sub-section # Security of section [Service] :
ReadWritePaths=/var/lib/jenkins/
I reloaded the systemd daemon to take the new file service configuration by using sudo systemctl daemon-reload
I reloaded Tomcat : sudo systemctl restart tomcat9
I went to http://www.example.com:8080/jenkins to access Jenkins installation. I see Jenkins logo but I get an error :
Error
Unable to create the home directory ‘/var/lib/tomcat/.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. See Container-specific documentation for more details of how to do this.
Obviously there is a permission problem, but I can't find the problem, my knowledge is too small on these technologies and on linux. In the video tutorial, the teacher does exactly what I did and everything worked perfectly. I searched a lot on stackoverflow and google but couldn't exactly find something similar.
Still, it's weird that jenkins wants to create the home directory at /var/lib/tomcat/.jenkins as I specified to create it in /var/lib/jenkins. So it looks like that, maybe, even if I restarted and reloaded all, what I've changed haven't been taken into consideration.
Thank you for the help :)
I found a solution to get around the problem thanks to the message indicating the creation of the .jenkins in the /var/lib/tomcat directory instead of /var/lib/jenkins as specified in the context.xml configuration file.
When you look in the /etc/passwd file, a tomcat user is present with /var/lib/tomcat as home directory. I simply changed this path to /var/lib/jenkins.
Then run sudo systemctl daemon-reload and sudo systemctl restart tomcat9 and it worked for me.
I found no other solution on stackoverflow and google either.
I still don't unsterdand why tomcat daemon does not take into account the context.xml file and prefers its own home directory to install jenkins.
If someone has a cleaner solution I am interested.
I'm configuring software on my first web server, so I am not totally familiar with how everything works, but here is the basic problem:
I have purchased hosting on a web server that runs on CentOS. I have been able to install postgreSQL via an install process that the hoster provides, so that my database will be local only to my home folder. That is working fine.
However, I am trying to install a postgreSQL extension called PostGIS. I have tried to compile it from source on my web server, but it now requires an additional library called GEOS. I downloaded the library from http://download/osgeo.org/geos/geos-3.6.2.tar.bz2, extracted it, and used make install to run it.
Now the problem is that it fails due to this error:
/bin/mkdir: cannot create directory /usr/local/include/geos: Permission Denied
It's not really a surprise, because it is trying to make a new directory in the system root folders, rather than within my personal home folder, which is the only one I have access to. I can't think of any other way around this. Am I just unable to install this library? Or can I "trick" it somehow into installing in in my home directory, where I have full admin rights?
I think You need to execute a command with root user privileges.
Because, make install command need root user privileges.
Like,
sudo make install
or with root user. Like,
sudo su
make install
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 spent numerous hours on an issue that has left me puzzled. I am attempting to install Drupal on Linux Redhat using apache, but it will not allow me to pass step 3 due to the fact that sites/default/files is not writable.
I have followed the instructions on Drupal's site, in their install.txt file as well as the instructions of others who have had the same error with no success.
I have granted permissions access all different ways root:root 777, root:apache 777, I have verified that apache is the user running the apache process and I am still stuck.
Note: I was able to complete the install on windows.
Any new ideas?
Okay, so after following directions from both official and non-official web sources, the one thing that was never instructed to do or try was to reboot the application AFTER making permission changes to the files directory. I tried it, and this solved the issue.
This is weird because I've never had to reboot an OS after making permission changes on a directory. Additionally I did restart httpd after each change thinking that would be sufficient. Hopefully this can help anyone else running Redhat 7 with the same issue.
Thanks, TH
I solved this problem by changing the security context of the directory "sites".
My Drupal core files are in: /var/www/html/drupal
Then I applied the command:
chcon -R -t httpd_sys_content_rw_t /var/www/html/drupal/sites/
Hi I am having trouble working with the Hudson workspace. I am using fabric to manipulate source files on the Hudson CI server. By default, the source files are downloaded from subversion server to workspace folder, with "hudson" as the owner.
On the ubuntu machine that runs Hudson CI, I cannot run the "cp" command on a source file even though the OS user belows to admin and adm group and also a sudoer. The error looks like:
cp: cannot create regular file `b.t':
Permission denied
What am I missing? Thanks for the help.
Check the user that Hudson runs under. Check the destination directory, if the Hudson user really has permission to create a file. You can login as the Hudson user and try to copy the file manually.
If nothing else helps, ask a Linux expert.