As an experiment in playing with the suid bit, I tried writing a script to run apt-get update from a bash script, and then set the suid bit on it, so I could just run ~/update or something.  apt-get update could be anything here - some program that listens on a privileged socket, or writes to / or anything else that has to be run as root. Please don't latch on to apt-get update here.  First try is this, which didn't work, failing with can't get lock, are you root?. The reason would seem to be .  #!/bin/bash apt-get update   So I thought I'd try to bypass the shell, but this didn't work either, for the same reason.  #!/usr/bin/perl system("apt-get", "update").   I've got the permissions correct (afaik) - sudo chmod 4755 ~/update.  Have I misunderstood setuid, or am I just missing something simple?
52794
The setuid permission bit tells Linux to run a program with the effective user id of the owner instead of the executor:  &gt; cat setuid-test.c  #include &lt;stdio.h&gt; #include &lt;unistd.h&gt;  int main(int argc, char** argv) {     printf("%d", geteuid());     return 0; }  &gt; gcc -o setuid-test setuid-test.c &gt; ./setuid-test  1000  &gt; sudo chown nobody ./setuid-test; sudo chmod +s ./setuid-test &gt; ./setuid-test  65534   However, this only applies to executables; shell scripts ignore the setuid bit:  &gt; cat setuid-test2  #!/bin/bash id -u  &gt; ./setuid-test2  1000  &gt; sudo chown nobody ./setuid-test2; sudo chmod +s ./setuid-test2 &gt; ./setuid-test2  1000     Wikipedia :     Due to the increased likelihood of security flaws, many operating systems ignore the setuid attribute when applied to executable shell scripts.   Assuming I'm willing to accept those risks, is there any way to tell Linux to treat the setuid bit the same on shell scripts as it does on executables?  If not, is there a common workaround for this problem? My current solution is to add a sudoers entry to allow ALL to run a given script as the user I want it run as, with NOPASSWD to avoid the password prompt. The main downsides to that is the need for a sudoers entry every time I want to do this, and the need for the caller to sudo some-script instead of just some-script
103984
I saw this snippet in some installation instructions:  $ apt-get install update   I know what apt-get install XXXX does and I know what apt-get update does, but I can't find any info on what this combined statement does. What does it do?
43827
The following crontab does not work:  # TEST LINE DOES DOT RUN */1 * * * * /bin/echo 'test '`/bin/date +%Y-%m-%d` &gt;&gt; /tmp/test   I also tried starting it with:  SHELL=/bin/bash   Update: I thought the backtick characters ` were the villains, but as the answer below clarifies the percentage % was the culprit!
83545
I usually use apt-get update &amp;&amp; apt-get upgrade to run my updates and upgrades instead of the GUI because it seems to run more quickly.   However, I've noticed lately that I often get a message that one of my upgrades was held back. I then usually run dist-upgrade to run it through and it works fine. As far as I can tell after reading  and its answers, dist-upgrade does all the same things and then some.   So, my question is: Why use apt-get upgrade at all? Why not use apt-get dist-upgrade all the time? Why does apt-get upgrade even exist?
49775
Hello im just new for Linux   I know that  sudo apt-get   is for installing application   but how I would know that I have installed the latest version of the application   for example apt-get install sun-java6-jdk   is there an option to upgrade or see the latest version   or its ok to install an old version the application and Linux will upgrade it for me ?
9997
I am wondering what sudo apt-get update does?  What does it update?
109919
What is the difference between apt-get update and apt-get upgrade?  Which should I run first?  Do any of them automatically run the other?
43213
When performing apt-get update, I get the following error:   root@ADS3-Debian6:/home/aluno# apt-get update Atingido http://sft.if.usp.br squeeze Release.gpg Ign http://sft.if.usp.br/debian/ squeeze/contrib Translation-en Ign http://sft.if.usp.br/debian/ squeeze/contrib Translation-pt Ign http://sft.if.usp.br/debian/ squeeze/contrib Translation-pt_BR   (...)  Obter:10 http://security.debian.org squeeze/updates/non-free i386 Packages [14 B] Baixados 612 kB em 4s (125 kB/s)                     Lendo listas de pacotes... Pronto There is no public key available for the following key IDs: 8B48AD6246925553
102206
I've noticed that the majority of Ubuntu help websites present apt commands in the following format:  sudo add-apt-repository ppa:[ppa-address] sudo apt-get update sudo apt-get install [application-name]   But I know that apt commands like this one work too:  sudo add-apt-repository ppa:[ppa-address] &amp;&amp; sudo apt-get update &amp;&amp; sudo apt-get install [application-name]   Is there a particular reason that most sites present in the first format? Are there known issues with chaining commands with &amp;&amp;, or to put it another way are there any benefits/drawbacks to using either method?  Further, other then loss of internet, are there any circumstances in which an apt command might fail?
89698
I am often interested in the installation triggers (postinst, postrm) or certain parts of packages (like /usr/share and /etc). Currently, I am running the next command to retrieve the source code:  apt-get source [package-name]   The downside is, this file is often much bigger than the binary package and does not reflect the installation tree.  Right now, I am downloading the packages through :      Download the actual file   This takes too long for me and as someone who really likes the shell, I would like to do something like the next (imaginary) command:  apt-get get-deb-file [package-name]   I could not find something like this in the . The most close I found was the --download-only switch, but this puts the package in /var/cache/apt/archives (which requires root permissions) and not in the current directory.
114182
I know that there are three command to update and then upgrade the whole system, these are:        sudo apt-get update        # Fetches the list of available updates   sudo apt-get upgrade       # Strictly upgrades the current packages   sudo apt-get dist-upgrade  # Installs updates (new ones)      Is there a super-upgrade command that combines all these commands to one?
21463
I've installed Kali Linux (normally I use ArchLinux, but I need Kali for work) and every time I want to upgrade, a few packages can't upgrade and are kept back. To force them to update I have to manually select them and perform an installation.  To update, I use the following command:  apt-get update &amp;&amp; apt-get upgrade   Even from a clean installation the problem persists. Is there someone with the same problem? How can I solve it permanently?
118572
I'm working with a support member for a product, and he insists that I need to be root to install a series of patches, and that sudo won't work; he doesn't provide a reason but seems very firm in his beliefs. Browsing Superuser I can't determine any possible reason for this being the case, and in confirmation, when I run:  sudo -l   I get:  ... User [MY USERNAME] may run the following commands on this host:     (ALL) ALL   Getting access from the Linux/server team to actually be root is not an imediate process as I understand, so I'd prefer to install them myself.  Is there any practical reason whatsoever why sudo would behave differently than root for installing software on a server?
57501
Both apt-get update and upgrade hang:  sudo apt-get update [sudo] password for xxx:  0% [Connecting to archive.ubuntu.com (2001:67c:1360:8001::17)]   I'm able to ping archive.ubuntu.com:  ping archive.ubuntu.com PING archive.ubuntu.com (91.189.88.162) 56(84) bytes of data. 64 bytes from yukinko.canonical.com (91.189.88.162): icmp_seq=1 ttl=50 time=42.2 ms 64 bytes from yukinko.canonical.com (91.189.88.162): icmp_seq=2 ttl=50 time=42.1 ms 64 bytes from yukinko.canonical.com (91.189.88.162): icmp_seq=3 ttl=50 time=42.1 ms ^C --- archive.ubuntu.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 42.169/42.206/42.265/0.240 ms   I checked , and I don't think its the same issue.  Any tips for investigating this further?
121213
So I was running apt-get upgrade on a server when the router decided it had been too long since it last made me angry: It dropped all connection. Moral of the story is to use screen a lot when you're on a bum router.  Anyway, I logged back in and found in htop that the process was still hanging there, still waiting for my Y/n to upgrade (hadn't hit it yet, luckily). Is there any way I can reattach to a session that had been broken off? I ended up just killing it since it wasn't in the middle of package management but it would be great to know for future reference.
33767
I tried sudo apt-get update in the new Windows Subsystem for Linux, but I get the following error:    The most relevant parts seem to be the "could not resolve" lines about Ubuntu servers, like:  Could not resolve 'archive.ubuntu.com'
18340
root@Kali:~# echo -e "deb http://http.kali.org/kali sana main non-free contrib\ndeb http://security.kali.org/kali-security/ sana/updates main contrib non-free" &gt; /etc/apt/sources.list  root@Kali:~# apt-get update  Ign:1 h t t p : / / http . kali . org/kali sana InRelease                                      Err:2 h t t p : / / http . kali . org/kali sana Release                                          404  Not Found [IP: 192.99.200.113 80] Ign:3 h t t p : / / http . kali . org/kali-security sana/updates InRelease Err:4 h t t p : / / http . kali . org/kali-security sana/updates Release   404  Not Found [IP: 192.99.200.113 80] Reading package lists... Done  E: The repository 'http://http.kali.org/kali sana Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'http://security.kali.org/kali-security sana/updates Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. root@Kali:~# apt-get update --fix-missing  Ign:1 h t t p : / / http . kali . org/kali sana InRelease                                      Ign:2 h t t p : / / http . kali . org/kali-security sana/updates InRelease                 Err:3 h t t p : / / http . kali . org/kali sana Release   404  Not Found [IP: 192.99.200.113 80] Err:4 h t t p : / / http . kali . org/kali-security sana/updates Release   404  Not Found [IP: 192.99.200.113 80] Reading package lists... Done E: The repository 'h t t p : / / http . kali . org/kali sana Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'h t t p : / / security . kali . org / kali-security sana/updates Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.  root@Kali:~# apt-get install tor Reading package lists... Done Building dependency tree         Reading state information... Done  Package tor is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'tor' has no installation candidate