snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Permission problem?

Open Arioo0 opened this issue 8 years ago • 7 comments

@snipe #### Please confirm you have done the following before posting your bug report:

Describe the bug Problem occurs many times and assets doesn't exist. I also cannot login to management. I really don't know why it occurs but (just guessing) maybe it is connected with my problem to connect to server via SSH?

Server (please complete the following information):

  • Snipe-IT Version The Newest
  • OS: [e.g. Ubuntu, CentOS] - Centos 7
  • Web Server: [e.g. Apache, IIS] - Apache
  • PHP Version - 7

Desktop (please complete the following information):

  • OS: [e.g. iOS] - Windows 7
  • Browser [e.g. chrome, safari] Mozilla
  • Version [e.g. 22] newest

Error Messages

(1/1) ErrorException file_put_contents(/var/www/html/snipeit/storage/framework/sessions/7N5zaPPvSx7ryqlQqzxk0ghKBRS99tRHMvC6uDVq): failed to open stream: Permission denied

in Filesystem.php (line 122) at HandleExceptions->handleError(2, 'file_put_contents(/var/www/html/snipeit/storage/framework/sessions/7N5zaPPvSx7ryqlQqzxk0ghKBRS99tRHMvC6uDVq): failed to open stream: Permission denied', '/var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', 122, array('path' => '/var/www/html/snipeit/storage/framework/sessions/7N5zaPPvSx7ryqlQqzxk0ghKBRS99tRHMvC6uDVq', 'contents' => 'a:5:{s:6:"_token";s:40:"MuK1LXZd9o8hEGGG5ZbrxbTo7d6JXOrusqkxsnFp";s:7:"backUrl";s:20:"http://172.19.34.106";s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:9:"_previous";a:1:{s:3:"url";s:26:"http://172.19.34.106/login";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', 'lock' => true)) at file_put_contents('/var/www/html/snipeit/storage/framework/sessions/7N5zaPPvSx7ryqlQqzxk0ghKBRS99tRHMvC6uDVq', 'a:5:{s:6:"_token";s:40:"MuK1LXZd9o8hEGGG5ZbrxbTo7d6JXOrusqkxsnFp";s:7:"backUrl";s:20:"http://172.19.34.106";s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:9:"_previous";a:1:{s:3:"url";s:26:"http://172.19.34.106/login";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', 2)in Filesystem.php (line 122) at Filesystem->put('/var/www/html/snipeit/storage/framework/sessions/7N5zaPPvSx7ryqlQqzxk0ghKBRS99tRHMvC6uDVq', 'a:5:{s:6:"_token";s:40:"MuK1LXZd9o8hEGGG5ZbrxbTo7d6JXOrusqkxsnFp";s:7:"backUrl";s:20:"http://172.19.34.106";s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:9:"_previous";a:1:{s:3:"url";s:26:"http://172.19.34.106/login";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', true)in FileSessionHandler.php (line 83) at FileSessionHandler->write('7N5zaPPvSx7ryqlQqzxk0ghKBRS99tRHMvC6uDVq', 'a:5:{s:6:"_token";s:40:"MuK1LXZd9o8hEGGG5ZbrxbTo7d6JXOrusqkxsnFp";s:7:"backUrl";s:20:"http://172.19.34.106";s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:9:"_previous";a:1:{s:3:"url";s:26:"http://172.19.34.106/login";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}')in Store.php (line 128) at Store->save()in StartSession.php (line 88) at StartSession->terminate(object(Request), object(Response))in Kernel.php (line 218) at Kernel->terminateMiddleware(object(Request), object(Response))in Kernel.php (line 189) at Kernel->terminate(object(Request), object(Response))in index.php (line 63)


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Arioo0 avatar May 15 '18 12:05 Arioo0

I tried to make update and it occurs messages like this:

./upgrade.php: line 1: ?php: No such file or directory ./upgrade.php: line 2: syntax error near unexpected token $_SERVER['HTTP_USER_AGENT']' ./upgrade.php: line 2: (PHP_SAPI !== 'cli' || isset($_SERVER['HTTP_USER_AGENT'])) && die('Access denied.');'

Arioo0 avatar May 15 '18 13:05 Arioo0

file_put_contents(/var/www/html/snipeit/storage/framework/sessions/7N5zaPPvSx7ryqlQqzxk0ghKBRS99tRHMvC6uDVq): failed to open stream: Permission denied

This means the permissions on your storage directory and sub-directories are wrong, and it cannot write to those directories. They must be writable by the web server.

snipe avatar May 16 '18 20:05 snipe

thanks for reply @snipe!

really appriciate, I'll back soon with reply if change priviliges for this directories solve my problem.

Cheers!

Arioo0 avatar May 16 '18 20:05 Arioo0

Hi @snipe! :)

I gave permission (write/read) to all sessions files in framework/session directory. I've checked all folders and all of them have read & write permissions.

Problem still occurs,

Now I've got message like this:

(1/1) ErrorException file_put_contents(/var/www/html/snipeit/storage/framework/sessions/kr9l039ywVv2UyF8WOq9vzonKreiGR1px8srwpJ4): failed to open stream: Permission denied

-- in Filesystem.php (line 122) at HandleExceptions->handleError(2, 'file_put_contents(/var/www/html/snipeit/storage/framework/sessions/kr9l039ywVv2UyF8WOq9vzonKreiGR1px8srwpJ4): failed to open stream: Permission denied', '/var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', 122, array('path' => '/var/www/html/snipeit/storage/framework/sessions/kr9l039ywVv2UyF8WOq9vzonKreiGR1px8srwpJ4', 'contents' => 'a:5:{s:6:"_token";s:40:"e40I39fFV1g2MaSdkJYqK6PDQrVeYbaqgV0egwEZ";s:7:"backUrl";s:26:"http://172.19.34.106/login";s:9:"_previous";a:1:{s:3:"url";s:26:"http://172.19.34.106/login";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}}', 'lock' => true))

And there would be nothing extraordinary about it but... this file is missing. Strange, cuz i didn't delete anything :( I have tried to make copy of one of the existing files with name of missing file but yeah.. it doesn't works :(

Also, when I tried to login to Asset Management there shows error like this:

file_put_contents(/var/www/html/snipeit/storage/framework/cache/ec/9f/ec9fbd724e3292b4b49ffa500c0fcd49a3d6925b): failed to open stream: Permission denied

This file exist, also apache have full permission to this file.

I hope you will help me because I've already greatly expanded my snipe! :(

Cheers!

Arioo0 avatar Jun 04 '18 06:06 Arioo0

If someone has the same problem i got solution:

If your permissions are 777 for Laravel Application folder and are still getting that error, it's because Seliux has blocked it. The application folder can be unblocked with the command below

"chcon -R -h -t httpd_sys_script_rw_t /var/www/html/snipeit/"

It should works now :)

Arioo0 avatar Jun 11 '18 11:06 Arioo0

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

stale[bot] avatar Aug 10 '18 12:08 stale[bot]

This issue has been automatically closed because it has not had recent activity. If you believe this is still an issue, please confirm that this issue is still happening in the most recent version of Snipe-IT and reply to this thread to re-open it.

stale[bot] avatar Aug 17 '18 12:08 stale[bot]