[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Installing packages as a non-root user (yes, I have permissions)



Hello,

I am trying to do a special setup that allows users to install their own software.

First, I install Debian into a chroot environment with debootstrap. THis has to be done as root for who-knows-what reason, and of course leaves binaries and conf files with typical root-owned permissions like you ahve on a normal system. This works pretty well.

Second, I use a log in shell that jails them into the chrooted debootstrap area.

Third, I chown -R <user> the who envoronment. According to the way I see it, that should give the user read/write/execute access to evertyhing that root has red/write/execute access to.

A bunch of things work fine, for example apt-get update (as the user). However, when I try to actually install a package with apt, I get errors like the following:


domwoodyuser@cadmium:~$ apt-get install python2.2
Reading Package Lists...
Building Dependency Tree...
The following NEW packages will be installed:
  python2.2
0 packages upgraded, 1 newly installed, 0 to remove and 9  not upgraded.
1 packages not fully installed or removed.
Need to get 1888kB of archives. After unpacking 6361kB will be used.
Get:1 http://ftp.us.debian.org sid/main python2.2 2.2.1-5 [1888kB]
Fetched 1888kB in 11m22s (2767B/s)
dpkg: requested operation requires superuser privilege
E: Sub-process /usr/bin/dpkg returned an error code (2)

domwoodyuser@cadmium:~$ apt-get install wget
Reading Package Lists...
Building Dependency Tree...
The following NEW packages will be installed:
  wget
0 packages upgraded, 1 newly installed, 0 to remove and 9  not upgraded.
1 packages not fully installed or removed.
Need to get 353kB of archives. After unpacking 1356kB will be used.
Get:1 http://ftp.us.debian.org sid/main wget 1.8.2-3 [353kB]
Fetched 353kB in 2m23s (2456B/s)
dpkg: requested operation requires superuser privilege
E: Sub-process /usr/bin/dpkg returned an error code (2)
domwoodyuser@cadmium:~$


I don't belive that there's any actual permissions problem, I think dkpg is being bone-headed. Probably whoever codes dpkg never thought you'd actally _want_ to use it as a non-root user :-)

Strace does not indicate (to me) any _real_ problems:


11875 execve("/usr/bin/dpkg", ["/usr/bin/dpkg", "--unpack", "/var/cache/apt/archives/wget_1.8.2-3_i386.deb"], [/* 11 vars */]) = 0
11875 uname({sys="Linux", node="cadmium", ...}) = 0
11875 brk(0)                            = 0x807ad70
11875 open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
11875 open("/etc/ld.so.cache", O_RDONLY) = 3
11875 fstat64(3, {st_mode=S_IFREG|0644, st_size=7161, ...}) = 0
11875 old_mmap(NULL, 7161, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40014000
11875 close(3)                          = 0
11875 open("/lib/libc.so.6", O_RDONLY)  = 3
11875 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\30\222\1\0004\0\0\0P\223\21\0\0\0\0\0004\0 \0\6\0(\0001\0000\0\6\0\0\0004\0\0\0004\0\0\0004\0\0\0\300\0\0\0\300\0\0\0\5\0\0\0\4\0\0\0\3\0\0\0`"..., 1024) = 1024
11875 fstat64(3, {st_mode=S_IFREG|0755, st_size=1153784, ...}) = 0
11875 old_mmap(NULL, 1166560, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40016000
11875 mprotect(0x40129000, 40160, PROT_NONE) = 0
11875 old_mmap(0x40129000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x113000) = 0x40129000
11875 old_mmap(0x4012f000, 15584, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4012f000
11875 close(3)                          = 0
11875 munmap(0x40014000, 7161)          = 0
11875 brk(0)                            = 0x807ad70
11875 brk(0x807ad98)                    = 0x807ad98
11875 brk(0x807b000)                    = 0x807b000
11875 umask(022)                        = 022
11875 open("/etc/dpkg/dpkg.cfg", O_RDONLY) = 3
11875 fstat64(3, {st_mode=S_IFREG|0644, st_size=232, ...}) = 0
11875 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40014000
11875 read(3, "# dpkg configuration file\n#\n# This file can contain default options for dpkg. All commandline\n# opti"..., 4096) = 232
11875 read(3, "", 4096)                 = 0
11875 close(3)                          = 0
11875 munmap(0x40014000, 4096)          = 0
11875 getuid32()                        = 503
11875 write(2, "dpkg: requested operation requires superuser privilege\n", 55) = 55
11875 _exit(2)                          = ?
11864 --- SIGCHLD (Child exited) ---
11864 wait4(11875, [WIFEXITED(s) && WEXITSTATUS(s) == 2], 0, NULL) = 11875
11864 rt_sigaction(SIGQUIT, {SIG_DFL}, {SIG_IGN}, 8) = 0
11864 rt_sigaction(SIGINT, {SIG_DFL}, {SIG_IGN}, 8) = 0
11864 brk(0x80b3000)                    = 0x80b3000
11864 close(12)                         = 0
11864 close(11)                         = 0
11864 close(10)                         = 0
11864 close(9)                          = 0
11864 close(8)                          = 0
11864 close(7)                          = 0
11864 close(6)                          = 0
11864 close(5)                          = 0
11864 munmap(0x40596000, 294912)        = 0
11864 munmap(0x40572000, 147456)        = 0
11864 munmap(0x40276000, 3128807)       = 0
11864 write(2, "E: ", 3)                = 3
11864 write(2, "Sub-process /usr/bin/dpkg returned an error code (2)", 52) = 52
11864 write(2, "\n", 1)                 = 1
11864 close(3)                          = 0
11864 munmap(0x40014000, 4096)          = 0
11864 _exit(100)                        = ?
(END)

Does anyone have any idea how I can get around this?
Yes, it really is necessary for the user to be able to use dpkg, in my particular case.

Thanks.

	JW


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: