Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want the files in /var/cache/apt/archives to always have read permissions for everyone. That is, whenever apt downloads a new file into this directory, it should make it world-readable. This is not the case currently, an example entry from ls -l /var/cache/apt/archives looks like this:

-rw------- 1 root root 26928 2009-05-03 20:34 /var/cache/apt/archives/sl_3.03-16_amd64.deb

What should I do to have the files always world-readable?

(Aside: I want this because I have a few Ubuntu laptops on a LAN and using scp or rsync I occasionally copy /var/cache/apt/archives from one laptop to the other. I don't use apt-cacher or squid-deb-proxy etc because at any point any subset of the laptops might be connected to the network; I have no central server.)

share|improve this question
add comment

1 Answer 1

APT is affected by the umask of root which is inherited from the global setting from /etc/profile. You've likely a line in it with umask 077. To make the files world-readable by default, you'll have to change it to:

umask 022

To change default the permissions of existing files, run:

sudo chmod 644 /var/cache/apt/archives/*

To copy archives from one machine to another, you can use netcat. On the source machine (ip = 10.0.0.2) which has .deb files to be distributed you need to install netcat-traditional and run:

cd /var/cache/apt/archives
tar c * | nc.traditional -l -p 1234

Replace * by the files you want to copy.

On the target machine, run:

nc 10.0.0.2 1234 | sudo tar xv -C /var/cache/apt/archives
share|improve this answer
    
Yeah that's it (memory was failing me sorry and btw don't mention reputation like that the next time it's rather condescending). –  RolandiXor Nov 8 '11 at 16:53
    
Won't changing the umask affect permissions of all files created by root? That might not be a good idea. Thanks for the netcat idea. Although if I'm executing something on both machines, I might as well sudo chmod og+r on one and then sudo rsync -av --progress --ignore-existing on the other (which is what I normally do) so that I get the benefits of --ignore-existing too. –  Prateek Nov 8 '11 at 17:53
    
@RolandTaylor sorry for insulting you, please accept my apologies. –  Lekensteyn Nov 8 '11 at 17:59
    
@prateek That would indeed affect the permissions of all files created by root. Your solution with rsync is even better, post it as answer. –  Lekensteyn Nov 8 '11 at 18:00
    
@Lekensteyn it's cool :D –  RolandiXor Nov 8 '11 at 18:02
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.