Solved

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

Posted on 2009-07-09
2
1,733 Views
Last Modified: 2013-12-15
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
Comment
Question by:jl66
2 Comments
 
LVL 23

Accepted Solution

by:
Maciej S earned 300 total points
ID: 24816775
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
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 200 total points
ID: 24816853
run commands below

chmod 777 /tmp
chmod +t /tmp

and try again
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question