tmpfs statt /tmp ?
-
- Posts: 70
- Joined: 2005-11-23 00:56
tmpfs statt /tmp ?
kann man das tmp verzeichnis problemlos durch ein tmpfs dir ersetzen, oder ist das bedenklich (sicherheit/performance) ?
ich hab nur 2 partitionen will aber /tmp noexec mounten. gibt es vielleicht noch einen anderen weg?
ich hab nur 2 partitionen will aber /tmp noexec mounten. gibt es vielleicht noch einen anderen weg?
-
- Posts: 5923
- Joined: 2004-05-23 12:53
Re: tmpfs statt /tmp ?
Ja, geht problemlos.tommbutu wrote:kann man das tmp verzeichnis problemlos durch ein tmpfs dir ersetzen, oder ist das bedenklich (sicherheit/performance) ?
Ein Loopfile.tommbutu wrote:gibt es vielleicht noch einen anderen weg?
-
- Posts: 70
- Joined: 2005-11-23 00:56
Re: tmpfs statt /tmp ?
kannst du bitte beschreiben wie es mit einem loopfile gelösst werden kann? hab dazu nichts gefunden mittels google
-
- Posts: 2223
- Joined: 2002-07-28 13:02
- Location: Berlin
Re: tmpfs statt /tmp ?
man mount sagt dazu:
Die Loop-Devices müssen gegebenenfalls noch im Kernel aktiviert werden, bin aber vom Loop auch weg und nehme jetzt tmpfs.
flo.
Code: Select all
THE LOOP DEVICE
One further possible type is a mount via the loop device. For example, the command
mount /tmp/fdimage /mnt -t msdos -o loop=/dev/loop3,blocksize=1024
will set up the loop device /dev/loop3 to correspond to the file /tmp/fdimage, and then mount this device on /mnt.
This type of mount knows about three options, namely loop, offset and encryption, that are really options to losetup(8). If the mount requires a passphrase, you will be prompted
for one unless you specify a file descriptor to read from instead with the --pass-fd option. (These options can be used in addition to those specific to the filesystem type.)
If no explicit loop device is mentioned (but just an option `-o loop' is given), then mount will try to find some unused loop device and use that. If you are not so unwise as to
make /etc/mtab a symbolic link to /proc/mounts then any loop device allocated by mount will be freed by umount. You can also free a loop device by hand, using `losetup -d', see
losetup(8).
flo.
-
- Posts: 70
- Joined: 2005-11-23 00:56
Re: tmpfs statt /tmp ?
ok bevor ich reboote hier nochmal verifizieren bitte.
cd /var/spool
dd if=/dev/zero of=tmp1 bs=1024 count=800000
mke2fs -j tmp1
mount -o loop,rw,nodev,nouser,noexec,nosuid /var/spool/tmp1 /tmp
jetzt in fstab
/var/spool/tmp1 /tmp ext3 loop,rw,nodev,nouser,noexec,nosuid 0 0
---------------
problem ist im moment das ich beim starten von mysql die meldung bekomme
Starting MySQL database server: mysqld...failed.
Please take a look at the syslog.
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
mysqld.sock existiert im angegebenen directory. muss also irgendwie jetzt mit dem neuen mounten des tmp zusammenhängen.
EDIT:
syslog meldet das ein tmp file in /tmp nicht erstellt werden konnte. /tmp ist 755 gemoutet und gehört natürlich root
cd /var/spool
dd if=/dev/zero of=tmp1 bs=1024 count=800000
mke2fs -j tmp1
mount -o loop,rw,nodev,nouser,noexec,nosuid /var/spool/tmp1 /tmp
jetzt in fstab
/var/spool/tmp1 /tmp ext3 loop,rw,nodev,nouser,noexec,nosuid 0 0
---------------
problem ist im moment das ich beim starten von mysql die meldung bekomme
Starting MySQL database server: mysqld...failed.
Please take a look at the syslog.
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
mysqld.sock existiert im angegebenen directory. muss also irgendwie jetzt mit dem neuen mounten des tmp zusammenhängen.
EDIT:
syslog meldet das ein tmp file in /tmp nicht erstellt werden konnte. /tmp ist 755 gemoutet und gehört natürlich root
-
- Userprojekt
- Posts: 7066
- Joined: 2002-10-09 14:30
- Location: Dorsten
Re: tmpfs statt /tmp ?
Probier's mal mit 1777./tmp ist 755 gemoutet und gehört natürlich root
DebianHowTo
echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc
echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc
-
- Posts: 70
- Joined: 2005-11-23 00:56
Re: tmpfs statt /tmp ?
selber fehler
mysqld[8314]: ^G/usr/sbin/mysqld: Can't create/write to file '/tmp/ibu8kITO' (Errcode: 13)
nachdem ich die fstab editiert habe...muss ich da nochmal restarten damit mysql das versteht? eigentlich müsste nach dem mount befehl mount -o loop,rw,nodev,nouser,noexec,nosuid /var/spool/tmp1 /tmp doch alles seinen gewohnten gang gehen :?:
mysqld[8314]: ^G/usr/sbin/mysqld: Can't create/write to file '/tmp/ibu8kITO' (Errcode: 13)
nachdem ich die fstab editiert habe...muss ich da nochmal restarten damit mysql das versteht? eigentlich müsste nach dem mount befehl mount -o loop,rw,nodev,nouser,noexec,nosuid /var/spool/tmp1 /tmp doch alles seinen gewohnten gang gehen :?:
-
- Posts: 2223
- Joined: 2002-07-28 13:02
- Location: Berlin
Re: tmpfs statt /tmp ?
Das Booten brauchst Du nicht unbedingt
wenn er hier nicht meckert, ist in der Regel auch die fstab o.k.
Gib doch mal die Permission vom /tmp und die Ausgabe von "mount" rüber - eventuell ist da noch ein Fehler drin.
flo.
Code: Select all
mount -a
Gib doch mal die Permission vom /tmp und die Ausgabe von "mount" rüber - eventuell ist da noch ein Fehler drin.
flo.
-
- Posts: 70
- Joined: 2005-11-23 00:56
Re: tmpfs statt /tmp ?
hab ein reboot hinter mir und nun scheint es zu funktionieren.
EDIT:
@flo
jip genau dieses mount -a hatte ich noch irgendwo im hinterkopf...aber ist mir nicht mehr eingefallen :)
@christian
wieso sticky und 777? alle rechte für group und other ist das so gut bei tmp...ich denk mal nicht...default sind doch 755, oder ?
EDIT:
@flo
jip genau dieses mount -a hatte ich noch irgendwo im hinterkopf...aber ist mir nicht mehr eingefallen :)
@christian
wieso sticky und 777? alle rechte für group und other ist das so gut bei tmp...ich denk mal nicht...default sind doch 755, oder ?
-
- Posts: 70
- Joined: 2005-11-23 00:56
Re: tmpfs statt /tmp ?
zu früh gefreut :?
mount -o loop,rw,noexec,nodev,nouser,nosuid,errors=continue /var/spool/tmpFile /tmp
meldet nichts
mount -a meldet auch nichts
/tmp ist mittlerweile 1777 war aber auch schon 755. mysql meldet immernoch in syslog das kein temp file in /tmp erstellt oder geschrieben werden konnte (siehe error von oben)
@flo
wie hast du denn tmpfs eingerichtet? vielleicht liegt ja dort irgendwo der fehler. am ext3 kann es nicht liegen oder ?
mount -o loop,rw,noexec,nodev,nouser,nosuid,errors=continue /var/spool/tmpFile /tmp
meldet nichts
mount -a meldet auch nichts
/tmp ist mittlerweile 1777 war aber auch schon 755. mysql meldet immernoch in syslog das kein temp file in /tmp erstellt oder geschrieben werden konnte (siehe error von oben)
@flo
wie hast du denn tmpfs eingerichtet? vielleicht liegt ja dort irgendwo der fehler. am ext3 kann es nicht liegen oder ?
-
- Posts: 2223
- Joined: 2002-07-28 13:02
- Location: Berlin
Re: tmpfs statt /tmp ?
Code: Select all
none /tmp tmpfs size=100M,nodev,noexec,nosuid 0 0
flo.
-
- Userprojekt
- Posts: 7066
- Joined: 2002-10-09 14:30
- Location: Dorsten
Re: tmpfs statt /tmp ?
Das Sticky-Bit dient ja gerade dazu, dass nur der Owner das File löschen kann, und da nun halt mal jeder in /tmp reinschreiben können sollte (bzw. muss), passt die Sache mit den 1777. qedwieso sticky und 777? alle rechte für group und other ist das so gut bei tmp...ich denk mal nicht...default sind doch 755, oder ?
DebianHowTo
echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc
echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc
-
- Posts: 471
- Joined: 2003-08-21 10:21
- Location: Berlin
Re: tmpfs statt /tmp ?
Nein, Default fuer /tmp ist 1777.tommbutu wrote:@christian
wieso sticky und 777? alle rechte für group und other ist das so gut bei tmp...ich denk mal nicht...default sind doch 755, oder ?
Das /tmp muß für alle UID und GID beschreibbar und lesbar sein. Durch das Sticky-Bit stellst Du sicher, daß nur der Eigentümer einer Datei diese löschen kann.
Programmme, die Dateien in /tmp anlegen wollen, sollten ein Verzeichnis /tmp/<username> mit 0700 erzeugen (das darf fehlschlagen=, dann sicherstellen, daß das /tmp/<username> auch ein Verzeichnis ist und es auch <username> gehört und 0700 ist, und dann darin die gewünschten Dateien erzeugen. Das Verzeichnis kann danach stehen bleiben.
-
- Project Manager
- Posts: 11186
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: tmpfs statt /tmp ?
Code: Select all
tmpfs /tmp tmpfs mode=1777,size=100M,nodev,noexec,nosuid 0 0
mount -t tmpfs -o mode=1777,size=100M,nodev,noexec,nosuid /tmp
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 70
- Joined: 2005-11-23 00:56
Re: tmpfs statt /tmp ?
ok damit kann man arbeiten. also mit dem fstab eintrag
tmpfs /tmp tmpfs mode=1777,size=100M,nodev,noexec,nosuid 0 0
erstellt das system einen 100MB speicherplatz...im ram speicher(?) und reserviert den für /tmp. die variante die ich oben beschrieben habe verwendet dafür eine tmpdatei die dann als /tmp über loopback gemountet wird...richtig?
wofür ist das:
mount -t tmpfs -o mode=1777,size=100M,nodev,noexec,nosuid /tmp
beim ausführen bekomm ich die usage von mount angezeigt. fehlt da nicht irgendwie das "was" nach /tmp gemountet wird?
------------------------------------
ich hatte im tutorial gelesen das zusätzlich /dev/shm (shared memory nehm ich mal an) abgesichert werden sollte
tmpfs /tmp tmpfs mode=1777,size=100M,nodev,noexec,nosuid 0 0
erstellt das system einen 100MB speicherplatz...im ram speicher(?) und reserviert den für /tmp. die variante die ich oben beschrieben habe verwendet dafür eine tmpdatei die dann als /tmp über loopback gemountet wird...richtig?
wofür ist das:
mount -t tmpfs -o mode=1777,size=100M,nodev,noexec,nosuid /tmp
beim ausführen bekomm ich die usage von mount angezeigt. fehlt da nicht irgendwie das "was" nach /tmp gemountet wird?
------------------------------------
ich hatte im tutorial gelesen das zusätzlich /dev/shm (shared memory nehm ich mal an) abgesichert werden sollte
das kommt hier aber auch nicht in frage oder? der befehl mount zeigt zwar tmpfs on /dev/shm type tmpfs (rw) aber das kann ich wohl nicht beeinflussen, oder?While we are at it we are going to secure /dev/shm. Look for the mount line for /dev/shm and change it to the following:
none /dev/shm tmpfs noexec,nosuid 0
-
- Project Manager
- Posts: 11186
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: tmpfs statt /tmp ?
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 70
- Joined: 2005-11-23 00:56
Re: tmpfs statt /tmp ?
weiss noch jemand wie ich debian umstricken muss damit apt-get keine probleme mehr macht?
reicht die lösung? oder funktioniert das mit tmpfs /tmp tmpfs mode=1777,size=100M,nodev,noexec,nosuid 0 0 nicht mehr?Auf Debian-Systemen ist noch etwas mehr Arbeit nötig, da dpkg auf /tmp zurückgreift, um die Pre-Installation von Packeten durchzuführen. Dazu erstellt man /etc/apt/apt.conf.d/50tmp mit folgenden Inhalt:
DPkg::Pre-Install-Pkgs {"mount -o remount,exec /tmp";};
DPkg::Post-Invoke {"mount -o remount /tmp";};
-
- Project Manager
- Posts: 11186
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: tmpfs statt /tmp ?
Beim umount eines tmpfs gehen die darin abgelegten Daten verloren, wenn Debian dieses nicht berücksichtigt hat...
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 70
- Joined: 2005-11-23 00:56
Re: tmpfs statt /tmp ?
das müsste doch eigentlich passen...es wird ja nur ein pre-install ausgeführt. tmp wird neu gemountet (exec) pre-install wird ausgeführt und anschliessend wird der alte noexec wieder gesetzt.
ich hoffe einfach mal das es so klappt. wenn jemand einen besseren vorschlag hat, kann er ja mal posten.
bis denne
ich hoffe einfach mal das es so klappt. wenn jemand einen besseren vorschlag hat, kann er ja mal posten.
bis denne
-
- Posts: 2223
- Joined: 2002-07-28 13:02
- Location: Berlin
Re: tmpfs statt /tmp ?
nee, das ist schon o.k. - ich mache genau das händisch und die Installationen laufen dann durch.
flo.
flo.
-
- Project Manager
- Posts: 11186
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: tmpfs statt /tmp ?
Das Problem mit dem Datenverlust betrifft ja nicht apt, sondern Software, welche vor dem umount Daten im /tmp abgelegt hat (z.B. PHP-Sessions, Sockets, etc...) und nach dem umount auf die verlorenen Daten zugreifen will/muss...
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 70
- Joined: 2005-11-23 00:56
Re: tmpfs statt /tmp ?
ist das bei allen verfahren mit tmpfs so? wie sieht es mit dem tmpfs File verfahren was ich weit oben genannt habe aus...würde tmp da auch immer geleert beim remount? wenn nicht arbeite ich in der richtung nochmal weiter. es läuft halt ein lamp und da ist ja nicht auszuschliessen das da mal eine php session rein muss usw
sorry ich konnte den ibm text noch nicht durchlesen...wenns drin steht lese ich den später mal
sorry ich konnte den ibm text noch nicht durchlesen...wenns drin steht lese ich den später mal