Permission Denied in Tmp

Permission denied in tmp

If the user:group running your web server is http:http and it's running on *nix, do this:

sudo chown -R http:http /srv/www/appname/

Also, silly question, but does /tmp/cache/assets exist?

And, if so, as @leonel points out, you may also need to change the permissions:

chmod 777 /srv/www/appname/tmp/cache

Be careful setting 777 permissions on anything. Only do this to verify a permissions issue, then reset to the most minimal permissions necessary.

mkdir in /tmp not working: Permission Denied

So I feel really stupid here, but I figured out what the answer to my own issue was.

Firstly, I was passing the wrong info on stdin (the program was using this info to create the correct folder and I had the input on one of the options formatted wrong so it couldn't make the folder).

Secondly, as @Mark Plotnick pointed out in the fourth comment, and as several others mentioned later on, I needed to add a leading zero to my the permission set on the line with mkdir.

Moral of the story: make sure you pass the correct info on stdin and get your permissions right. XD

Permission denied accessing /tmp/mongodb-27017.sock from nodejs

mongod takes the --filePermissions 0666 option to set the socket file permissions to the desired value.

There is most likely an equivalent option that can be set in the configuration file.

Errno 13 Permission denied: 'tmp\\csv.gz


import os
import shutil
import time
import gzip

newfile_path = 'Todas as Ações Executadas - Outsourcer.csv'
## Download to folder and use whatever comes out
file_downloaded = False
while not file_downloaded:
for file in os.listdir("tmp"):
if file.endswith("csv.gz"):
fname = os.path.join('tmp', file)
logmsg = ("Extracting ", fname)
instalog.appendMessage('INFO', logmsg)
try:
with gzip.open(fname) as f_in:
with open(newfile_path, 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
file_downloaded = True
break
except OSError:
time.sleep(1)
elif file.endswith(".csv"):
fname = os.path.join('tmp', file)
logmsg = ("File was not compressed ", fname)
instalog.appendMessage('INFO', logmsg)
shutil.copy(fname, newfile_path)
file_downloaded = True
break

Notes:

  • I've renamed fp to fname, since fp is often taken to mean file pointer, while it is a file name or path
  • gzip.open by defaults opens in binary mode. Thus, the unzipped file is written as binary as well. I am not sure how well this works for a CSV file under Windows, since a CSV file is a text file.
  • I have replaced the shutil.copyfileobj in the elif clause with a simple shutil.copy
  • The elif clause does not have a try-except clause. This may mean that an uncompressed file may be copied if it's only partially downloaded. There is no way to check if the file is fully downloaded, unless you know the file size beforehand (and test for that). So this may result in partially copied files only.

Rails passenger /tmp/ folder permission denied

Passenger assumes the owner of config/environement.rb (see http://www.modrails.com/documentation/Security%20of%20user%20switching%20support.html, restart apache/passenger for changes to take effect) and this user needs write and execute rights for tmp.

So, find out who owns config/environement.rb:

$> ls -lah config/environment.rb 
-rwxr-xr-x 1 www-data www-data 152 Jan 22 07:53 config/environment.rb

I choose www-data here, as this is the user my apache uses. I don't reccomend root.

$> chown www-data:www-data config/environment.rb

Giving this user full access to the tmp folder and its contents should be sufficient:

$> chmod -R 700 tmp


Related Topics



Leave a reply



Submit