[OP Solved] Permission issues

Moderator: crythias

Locked
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

[OP Solved] Permission issues

Post by tarnalcock »

If I am logged in as myself I get:

tarn@otrsserver:/opt$ cd otrs
-bash: cd: otrs: Permission denied

If I try run the set permissions script as root:

tarn@otrsserver:/opt$ sudo su
root@otrsserver:/opt# cd otrs
root@otrsserver:/opt/otrs# ./bin/otrs.SetPermissions.pl --otrs-user=otrs --web-user=www-data --otrs-group=nogroup --web-group=www-data /opt/otrs
bash: ./bin/otrs.SetPermissions.pl: Permission denied

This all came about because the scheduler task is not starting automatically due to permissions issues.

Can anyone please assist?

Is there any way I can get a recursive listing of the required permissions and update them manually also how can it be that root user cannot run the script.

I am running Ubuntu 12.04.3 LTS (precise).
Last edited by tarnalcock on 09 Dec 2013, 04:25, edited 1 time in total.
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Permission issues

Post by jojo »

is the script executable?
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

Re: Permission issues

Post by tarnalcock »

Yes. I used it when installing. But somehow my permissions have all become messed up.
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

Re: Permission issues

Post by tarnalcock »

As a desperate attempt to get this working I did chmod -R 775 /opt/otrs and tried running the permissions script again. This time it runs but I get

$ ./otrs.SetPermissions.pl --otrs-user=otrs --web-user=www-data --otrs-group=nogroup --web-group=www-data /opt/otrs
bin/otrs.SetPermissions.pl - set OTRS file permissions
Copyright (C) 2001-2013 xxx, http://otrs.com/
Setting permissions on /opt/otrs
Error in chown 999 33 /opt/otrs/var/tmp/CacheFileStorable/GenericAgent/8/6/860c89dd3ea873874cb968dcb81a94bd: Operation not permitted
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

Re: Permission issues

Post by tarnalcock »

basically what I think is require is to redefine all the permissions manually from scratch. Is this possible?
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Permission issues

Post by jojo »

only via script (if root is not able to change permission you might have a more severe issue)
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

Re: Permission issues

Post by tarnalcock »

So would it be best to back up all configs and db and reinstall?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Permission issues

Post by crythias »

tarnalock, you should attempt to run setpermissions as root.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

Re: Permission issues

Post by tarnalcock »

crythias wrote:tarnalock, you should attempt to run setpermissions as root.
Crythias: I did try that. As above:
root@otrsserver:/opt/otrs# ./bin/otrs.SetPermissions.pl --otrs-user=otrs --web-user=www-data --otrs-group=nogroup --web-group=www-data /opt/otrs
bash: ./bin/otrs.SetPermissions.pl: Permission denied
I have since reinstalled otrs and restored my configuration and database backup. However I am still having issues with mail.

Firstly when logging in I get the "Scheduler process is registered but might not be running." error. If I force start it goes away temporarily but reappears randomly or after rebooting.

Mail is not coming in to the system unless I manually click fetch mail in the admin dashboard.

If I run otrs.PostMasterMailbox.pl as root, I get
POP3: Connection to mail.mymailserver.co.za closed.
where mymailserver = my domain.
If I do the same as www-data (the web user) it works.
BUT if I do this as otrs which is the otrs user I get:
$ $ ./otrs.PostMasterMailbox.pl
ERROR: Permission denied: /opt/otrs/Kernel/Config/Files/ZZZAAuto.pm
ERROR: Permission denied: /opt/otrs/Kernel/Config/Files/ZZZAuto.pm
POP3: Connection to mail.mymailserver.co.za closed.

I have run otrs.SetPermissions.pl as root and it ran fine. Although one thing I did notice:
root@otrsserver:/opt/otrs/bin# ./otrs.SetPermissions.pl /opt/otrs --otrs-user=otrs --web-user=www-data --otrs-group=nogroup --web-group=www-data
bin/otrs.SetPermissions.pl - set OTRS file permissions
Copyright (C) 2001-2013 xxx, http://otrs.com/
Setting permissions on /opt/otrs
Setting permissions on /opt/otrs/var
Setting permissions on /opt/otrs/bin/*
Setting permissions on /opt/otrs/scripts/
Setting permissions on /opt/otrs/Kernel/Config.pm
In another post I have seen the expected output to be this:
bin/otrs.SetPermissions.pl <1.4.4.1> – set OTRS file permissions
Copyright (C) 2001-2012 xxx, http://otrs.org/
Setting permissions on /opt/otrs
Setting permissions on /opt/otrs/var
Setting permissions on /opt/otrs/bin/*
Setting permissions on /opt/otrs/scripts/*.pl
Setting permissions on /opt/otrs/scripts/tools/*.pl
Setting permissions on Kernel/Config.pm
Setting owner rw and group ro permissions on /opt/otrs/
Could it be that the missing line for setting the owner is the issue?
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

Re: Permission issues

Post by tarnalcock »

Another permissions related issue I am facing is this, in my error log:
Fri Dec 6 13:20:03 2013 error OTRS-otrs.GenericAgent.pl-73 mkdir /opt/otrs/var/tmp/CacheFileStorable/CacheInternalUser/5: Permission denied at /opt/otrs/Kernel/System/Cache/FileStorable.pm line 79
SO I think it is fair to say that there is something to do with permissions between OTRS 3.3.2 and Ubuntu server.

I have reinstalled numerous times, run all the scripts exactly as directed by the OTRS manual as well as other people's posts. Nothing helps.

I am not overly concerned about security. Would it not be possible to just grant all local users full permissions to all files in /opt/otrs? -Althoug getting to the root :D of the problem would be great too!

This is what I tried yesterday but I messed it up hence the reinstall.

Is there no kind of script for checking required permissions in OTRS and reporting those that need correcting. Somewhat akin to CheckModules.pl?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Permission issues

Post by crythias »

bin/otrs.SetPermissions.pl --otrs-user=otrs --web-user=www-data --otrs-group=www-data --web-group=www-data /opt/otrs
bin/otrs.SetPermissions.pl - set OTRS file permissions
Copyright (C) 2001-2013 xxx, http://otrs.com/
Setting permissions on /opt/otrs
Error in chown 1001 33 /opt/otrs: Operation not permitted

sudo bin/otrs.SetPermissions.pl --otrs-user=otrs --web-user=www-data --otrs-group=www-data --web-group=www-data /opt/otrs
bin/otrs.SetPermissions.pl - set OTRS file permissions
Copyright (C) 2001-2013 xxx, http://otrs.com/
Setting permissions on /opt/otrs
Setting permissions on /opt/otrs/var
Setting permissions on /opt/otrs/bin/*
Setting permissions on /opt/otrs/scripts/
Setting permissions on /opt/otrs/Kernel/Config.pm

-rw-rw-r-- 1 otrs www-data 287188 Dec 2 17:01 ZZZAAuto.pm
-rw-rw-r-- 1 otrs www-data 8690 Dec 2 17:01 ZZZAuto.pm
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

Re: Permission issues

Post by tarnalcock »

crythias wrote:bin/otrs.SetPermissions.pl --otrs-user=otrs --web-user=www-data --otrs-group=www-data --web-group=www-data /opt/otrs
bin/otrs.SetPermissions.pl - set OTRS file permissions
Copyright (C) 2001-2013 xxx, http://otrs.com/
Setting permissions on /opt/otrs
Error in chown 1001 33 /opt/otrs: Operation not permitted

sudo bin/otrs.SetPermissions.pl --otrs-user=otrs --web-user=www-data --otrs-group=www-data --web-group=www-data /opt/otrs
bin/otrs.SetPermissions.pl - set OTRS file permissions
Copyright (C) 2001-2013 xxx, http://otrs.com/
Setting permissions on /opt/otrs
Setting permissions on /opt/otrs/var
Setting permissions on /opt/otrs/bin/*
Setting permissions on /opt/otrs/scripts/
Setting permissions on /opt/otrs/Kernel/Config.pm


-rw-rw-r-- 1 otrs www-data 287188 Dec 2 17:01 ZZZAAuto.pm
-rw-rw-r-- 1 otrs www-data 8690 Dec 2 17:01 ZZZAuto.pm
Crythias, I presume that you are showing me how running this as root helps? I have been doing so. Either while logged in as root (sudo su) as well as using sudo from my own login. It has not helped.
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

Re: Permission issues

Post by tarnalcock »

I have even tried the exact thing you posted there. Does not work. I still get permissions errors peppering my logs! Thank you for trying.
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Permission issues

Post by reneeb »

The cronjobs should be run as the web-user...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Permission issues

Post by crythias »

You're still getting *all* of your errors you've previously posted? Including the issue with
Error in chown 999 33 /opt/otrs/var/tmp/CacheFileStorable/GenericAgent/8/6/860c89dd3ea873874cb968dcb81a94bd: Operation not permitted

and

bash: ./bin/otrs.SetPermissions.pl: Permission denied

and

ERROR: Permission denied: /opt/otrs/Kernel/Config/Files/ZZZAAuto.pm
ERROR: Permission denied: /opt/otrs/Kernel/Config/Files/ZZZAuto.pm

?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

Re: Permission issues

Post by tarnalcock »

Crythias, I cannot confirm whether *all* ot the errors still existed as various ones either appeared or disappeared as I tried various solutions to solve the problem.

I was finally able to fix it by changing the apache default user and group and then re-running the permissions script.

Thank you for all the input.
tarnalcock
Znuny newbie
Posts: 23
Joined: 26 Nov 2013, 10:50
Znuny Version: 3.3.1
Real Name: Tarn
Company: Guccio Computer Consulting

Re: [OP Solved] Permission issues

Post by tarnalcock »

So. Just in case anyone else gets permissions errors with Ubuntu Server and OTRS, the trick is to
  • 1. edit /etc/apache2/envvars and set
    • Code: Select all

          export APACHE_RUN_USER=(yourotrsusersname) (e.g otrs)
          export APACHE_RUN_GROUP=(yourotrsusersgroup) (e.g otrs)
    2. Re-run the otrs.SetPermissions.pl script as root setting all usernames and groups for the ones set above.
    • i.e.

      Code: Select all

      bin/otrs.SetPermissions.pl --otrs-user=otrs --otrs-group=otrs --web-user=otrs --web-group=otrs /opt/otrs
    3. Restart apache.

    4. Smile because your two weeks of hell are finally over. :D
Locked