DaemonForums  

Go Back   DaemonForums > Other Operating Systems > Other BSD and UNIX/UNIX-like

Other BSD and UNIX/UNIX-like Any other flavour of BSD or UNIX that does not have a section of its own.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 21st April 2016
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default /var/empty on Linux

Does anyone know what the equivalent of /var/empty is on Linux?

I wrote a program that chroots for security reasons. After initialisation it doesn't need to open any more files or devices, so chrooting to an empty directory would work just fine. On FreeBSD and OpenBSD I have the /var/empty directory for exactly this reason. IIRC it's even protected with the system immutable flag to prevent accidental writes.

On my CentOS 7 machine I have a /var/empty, but that has an (empty) sshd directory in it (?) On Ubuntu 15.04 I don't have a /var/empty at all.

Do I need to create a useless and empty /var/run/myprogram directory? Or is there some equivalent?
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #2   (View Single Post)  
Old 21st April 2016
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

My Slackware 14.0 has a /var/empty, with nothing in it. Perhaps none of the installed programs are configured to use it? You could create one if you need it. For chroot-ing I've also created /var/jails with subdirectories for dnscrypt-proxy, mail (sendmail) and named.
Reply With Quote
  #3   (View Single Post)  
Old 5th June 2017
hermano hermano is offline
Port Guard
 
Join Date: Mar 2017
Posts: 18
Default

Hmm, /dev/null?
Reply With Quote
  #4   (View Single Post)  
Old 5th June 2017
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bitchy Nerd Elitist
 
Join Date: Dec 2015
Location: London
Posts: 456
Default

This link suggests that /var/empty is a part of most Linux systems too, albeit not defined in the FHS.

The Arch Linux filesystem package also includes /var/empty so it seems to be "supported".

heir(7) in my Arch box notes:
Code:
       /var/tmp
              Like /tmp, this directory holds temporary files stored for an unspecified
              duration.
Perhaps this would be suitable?

EDIT: ha! Necrobump! Sorry...

Last edited by Head_on_a_Stick; 5th June 2017 at 03:08 AM. Reason: excusing my reply to a semi-necrobump.
Reply With Quote
  #5   (View Single Post)  
Old 9th June 2017
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

The thing with chroot-ing it to /var/tmp/ (or /tmp/) is that you don't know which files may be there, and that the chrooting program may accidentally expose information present in those directories, or even worse allow modification of those files!

With /var/empty/, I don't need to worry about any of that.

At any rate, my eventual solution was to create an empty /var/program_name/ directory. I later added some support for file caching, so I had to do that in the long run anyway :-)
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
a strange package problem .. bash @name exists but plist empty daemonfowl OpenBSD Packages and Ports 25 11th April 2012 02:06 AM
Why does pkg_add sometimes report "packages is empty" ? sw2wolf OpenBSD Packages and Ports 2 22nd March 2012 12:51 AM
How do we verify if directory is empty? sharris FreeBSD General 8 4th January 2012 03:37 PM
Snapshot Packages Empty - part of commit? IronForge OpenBSD Packages and Ports 3 16th September 2011 10:32 PM
Other Another Linux Security Breach (this time at Linux Foundation) vermaden News 0 12th September 2011 07:00 AM


All times are GMT. The time now is 02:33 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick