Puppet permissions denied creating directory? - puppet

I'm applying a .pp config file via puppet agent -t.
When the following part of the config runs I get a permission error:
file { "/opt/2klic":
ensure => directory,
}
Error: Could not set 'directory' on ensure: Permission denied #
dir_s_mkdir - /opt/2klic at
/etc/puppetlabs/code/environments/production/manifests/site.pp:20
Error: Could not set 'directory' on ensure: Permission denied #
dir_s_mkdir - /opt/2klic at
/etc/puppetlabs/code/environments/production/manifests/site.pp:20
Wrapped exception: Permission denied # dir_s_mkdir - /opt/2klic Error:
/Stage[main]/Main/Node[default]/File[/opt/2klic]/ensure: change from
absent to directory failed: Could not set 'directory' on ensure:
Permission denied # dir_s_mkdir - /opt/2klic at
/etc/puppetlabs/code/environments/production/manifests/site.pp:20
I attempted to fix the issue by adding the user puppet to the sudo group:
sudo usermod -a -G sudo puppet
But it doesn't fix the permission issue.

Related

Permission denied when using logrotate for logs outside /var/logs

After creating a custom log configuration for my app by adding myapp.conf into the /etc/rsyslog.d/ folder with the contents listed below:
if ( $programme contains "myapp" ) then {
action(type="omfile" file="/appl/logs/myapp.lo" FileOwner="myappowner" FileGroup="myappgroup" FileCreateMode="0644")
}
I went on creating a logrotate config as follows:
/appl/logs/myapp.log {
su myappowner myappgroup
rotate 10
maxsize 50M
monthly
missingok
compress
}
The logs are being created as expected but when I try to debug the newly created logrotate configuration with logrotate -d /etc/logrotate.d/myapp I get:
error: stat of /appl/logs/myapp.log failed: Permission denied
The /appl/logs/ folder is owned by the myappownder and myappgroup and the /appl/logs/myapp.log file has 644 permissions.

missing permissions to create folder from java application

I am setting up a spring boot application and when running it, it should generate a folder in the source directory (see step 3: https://www.baeldung.com/spring-boot-h2-database)
But when running the application I receive the following error:
org.h2.message.DbException: Log file error: "/data/sample.trace.db", cause: "org.h2.message.DbException: Error while creating file ""/data"" [90062-200]" [90034-200]
at org.h2.message.DbException.get(DbException.java:194)
at org.h2.message.TraceSystem.logWritingError(TraceSystem.java:294)
at org.h2.message.TraceSystem.openWriter(TraceSystem.java:315)
at org.h2.message.TraceSystem.writeFile(TraceSystem.java:263)
at org.h2.message.TraceSystem.write(TraceSystem.java:247)
at org.h2.message.Trace.error(Trace.java:194)
it seems to be a permission problem but I do not understand why. My current user, has admin permissons. What am I missing here?
When I encounter this problem on my machine I proceed through following steps:
If I don't know what user & group I am right now: $whoami && groups
What user is the program executed with (I'm not into Java so eg. PHP "echo exec('whoami');")
Who has access to the directory: $ls -la
3.1 If only owner has access and you are not the owner: $chown user:group file
3.2 If group and owner should have access consider: $chmod 770 file

Jenkins console shows permission denied error when I run the test.sh file

I have created one .sh which contains java command required to run the tesng.XML file when I run this test.sh file on Jenkins it shows me permission denied error.
Jenkins console output:
Building in workspace /home/dev2/eclipse-workspace/weeklytask
[weeklytask] $ /bin/sh -xe /tmp/jenkins7439378074963422991.sh
+ ./test.sh
[TestNG] Running:
/home/dev2/eclipse-workspace/weeklytask/enquiryreminder.xml
Starting ChromeDriver 2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7) on port 8120
Only local connections are allowed.
FOLLOW UP REMINDER CRON WEEKLY CHECK TESTCASE FAILED
PLEASE CHECK THE TIME INTERVAL SETTING
SET THE TIME INTERVAL TO 600
FOLLOW UP REMINDER CRON WEEKLY CHECK TESTCASE FAILED
PLEASE CHECK THE TIME INTERVAL SETTING
SET THE TIME INTERVAL TO 600
[[Utils]] Error while writing to /home/dev2/eclipse-workspace/weeklytask/test-output/Suite/Test.html: /home/dev2/eclipse-workspace/weeklytask/test-output/Suite/Test.html (**Permission denied**)
[[Utils]] Error while writing to /home/dev2/eclipse-workspace/weeklytask/test-output/Suite/Test.xml: /home/dev2/eclipse-workspace/weeklytask/test-output/Suite/Test.xml (Permission denied)
===============================================
Suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================
[[Utils]] Error while writing to test-output/junitreports/TEST-verify.enquiryremindertest.xml: test-output/junitreports/TEST-verify.enquiryremindertest.xml (Permission denied)
Jenkins use the user jenkins. If you have created your file with other user, there might be permission issue on the file. To resolve change the permission on the files and allow other users to execute the script. You can use
chmod +x test.sh
The directory eclipse-workspace belongs to dev2 user and here jenkins user is trying to write data in it. Give jenkins write permission on this folder. try
sudo chmod -R a+rw /home/dev2/eclipse-workspace
For more details about permission you can view This tutorial

AQUA, permission denied

I am trying to compile the alignment program AQUA with a .tcl script. I have compiled the programs and set the environmental variables in the .tcl file but I am still getting the following error;
tclsh AQUA.tcl mtDNA.fas
stderr couldn't execute "/home/shump/AQUA/muscle": permission denied
couldn't execute "/home/shump/AQUA/rascal": permission denied
couldn't execute "/home/shump/AQUA/normd": permission denied
One normd file does not exists yet (mtDNA.fas.muscle.normd), full stop
If anyone could put me in the right direction to solve this issue, I would appreciate it.
P
Most likely you need to set the execute bit permission on the files mentioned, using:
chmod +x /home/shump/AQUA/muscle /home/shump/AQUA/rascal /home/shump/AQUA/normd

Puppet Dashboard permissions: Permission denied - /var/lib/puppet/reports/

I'm setting up the Puppet Dashboard for the first time. I have it running with the passenger module in Apache.
sudo rake RAILS_ENV=production reports:import
When I run this command, the tasks appear in the dashboard as failed.
630 new failed tasks
The details for each failure look something like this:
Importing report 201212270754.yaml at 2012-12-27 09:21 UTC
Permission denied - /var/lib/puppet/reports/rb-db1/201212270754.yaml
Backtrace
/usr/share/puppet-dashboard/app/models/report.rb:86:in `read'
/usr/share/puppet-dashboard/app/models/report.rb:86:in `create_from_yaml_file'
The report files were owned by puppet:puppet with a 640 permission by default.
I ran chmod a+rw on the reports directory, but I still get the same errors.
Any ideas on what I might be doing wrong here?
If you are running the puppet-dashboard server as root instead of as the puppet-dashboard user, you will see this error. My system is using /usr/share/puppet-dashboard/script/server on centos 6.4 using the puppet-dashboard-1.2.23-1.el6.noarch rpm from puppetlabs.
[root#hadoop01 puppet-dashboard]# cat /etc/sysconfig/puppet-dashboard
#
# path to where you installed puppet dashboard
#
DASHBOARD_HOME=/usr/share/puppet-dashboard
#DASHBOARD_USER=puppet-dashboard
DASHBOARD_USER=root
DASHBOARD_RUBY=/usr/bin/ruby
DASHBOARD_ENVIRONMENT=production
DASHBOARD_IFACE=0.0.0.0
DASHBOARD_PORT=3000
edit the file like above and then run the command
/etc/init.d/puppet-dashboard restart && /etc/init.d/puppet-dashboard-workers restart
my puppet-dashboard version is 1.2.23

Resources