OpenVZ Forum


Home » General » Support » /dev (devtmpfs) permissions is 1777 (el6 containers after start has permissions 1777 on /dev (like /tmp))
Re: /dev (devtmpfs) permissions is 1777 [message #48348 is a reply to message #48347] Mon, 15 October 2012 14:39 Go to previous messageGo to previous message
umask is currently offline  umask
Messages: 23
Registered: December 2007
Junior Member
I noticed this problem some time ago.

I suspected that reason of problem is in precreated templates.

For check this fact I wrote script which creates el6 (based on centos) container from scratch:

#!/bin/bash -x

TMPDIR=$(mktemp -d)

vzctl stop 777

DESTDIR=/vz/private/777

[[ -d ${DESTDIR} ]] && rm -rf ${DESTDIR}

mkdir -p ${DESTDIR}

rpm --root ${DESTDIR} --initdb

yum install -y yum-utils

yumdownloader --destdir ${TMPDIR} centos-release centos-release-cr

TO_INSTALL=""
for i in ${TMPDIR}/*.rpm; do
	TO_INSTALL="${TO_INSTALL} ${i}"
done
rpm --root ${DESTDIR} -i ${TO_INSTALL}

# Save random seed
touch ${DESTDIR}/var/lib/random-seed
chmod 600 ${DESTDIR}/var/lib/random-seed
dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 2>/dev/null

rpm --root ${DESTDIR} --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

yum --installroot=${DESTDIR} install -y postfix filesystem tzdata glibc procps \
	coreutils rpm yum yum-utils udev openssh basesystem bash grep MAKEDEV \
	openssl gnupg2 logrotate rsyslog screen openssh-server openssh-clients \
	info ca-certificates libuuid sed vim-enhanced findutils iproute tmpwatch \
	wget curl patch vixie-cron sysstat htop telnet which diffutils rsync \
	sudo yum-cron psacct lftp tcpdump numactl git vconfig nc xz bzip2 \
	nscd

cat << _EOF_ > ${DESTDIR}/etc/fstab
none 	/dev/pts	devpts	gid=5,mode=620	0	0
_EOF_
chmod 0644 ${DESTDIR}/etc/fstab

mkdir -p ${DESTDIR}/dev/pts

for INPATH in dev etc/udev/devices; do
	/sbin/MAKEDEV -x -d ${DESTDIR}/${INPATH} console core fd full kmem kmsg mem null port \
		ptmx {p,t}ty{a,p}{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f} random \
		urandom zero ram{,0,1,disk} std{in,out,err}
done

sed -i 's/^ACTIVE_CONSOLES=\(.*\)/#ACTIVE_CONSOLES=\1\nACTIVE_CONSOLES=""/g' ${DESTDIR}/etc/sysconfig/init 

SERVICES="(network|crond|sshd|sysstat|snmpd|syslog|psacct|udev-post|nscd)"
chroot ${DESTDIR} "/sbin/chkconfig" "--list" | grep -oP '^\S+' | sort | uniq | egrep -vE "${SERVICES}" | xargs -I{} chroot ${DESTDIR} "/sbin/chkconfig" "{}" "off"
chroot ${DESTDIR} "/sbin/chkconfig" "--list" | grep -oP '^\S+' | sort | uniq | egrep -E "${SERVICES}" | xargs -I{} chroot ${DESTDIR} "/sbin/chkconfig" "{}" "--level" "2345" "on"

cat << _EOF_ > ${DESTDIR}/etc/sysconfig/clock
ZONE="Europe/Moscow"
_EOF_
chroot ${DESTDIR} "/usr/sbin/tzdata-update"
chroot ${DESTDIR} "rm -fv /etc/mtab; ln -s /proc/mounts /etc/mtab"


Issue with /dev permissions reproduces in container which created by above script.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to dump the containers configuration files alone using vzdump util!!
Next Topic: Reference - Error boot new kernel compile openvz for ppc64 bits
Goto Forum:
  


Current Time: Sat Aug 02 20:01:47 GMT 2025

Total time taken to generate the page: 0.75981 seconds