Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1808
  • Last Modified:

E212: Can't write a file on /tmp on Linux

I have a problem with writing a file to /tmp as normal user (not root). I got this error when I wanted to write with vi.
-------
"/tmp/test.txt"
"/tmp/test.txt" E212: Can't open file for writing
------
ls -ld /tmp
drwxr-xr-x 11 root root 4096 Jul  9 12:17 /tmp
uname -a
Linux xxx-yyy 2.6.18-128.el5 #1 SMP Wed Dec 17 13:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
Do you know which part I need to check?
0
jl66
Asked:
jl66
2 Solutions
 
Maciej SsysadminCommented:
You are missing sticky bit on your /tmp. Additionally your user (unless it is root) is not permitted to create files in /tmp.
Run as root:
chmod 1777 /tmp
0
 
omarfaridCommented:
run commands below

chmod 777 /tmp
chmod +t /tmp

and try again
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now