Re: aptitude works as root, not with sudo
Tom Cook, 2002-Oct-23 15:45 +0930:
> On 0, Jeff <jcoppock1@attbi.com> wrote:
> [snip]
> > I get something similar running
> >
> > $ sudo apt-get update && apt-get upgrade
> >
> > The update works fine, but the upgrade gets this:
> >
> > <snipped update stuff>
> > Fetched 2287kB in 13s (172kB/s)
> >
> > Reading Package Lists... Done
> > Building Dependency Tree... Done
> > E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
> > E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
>
> That would be because your shell is dividing the line:
>
> sudo apt-get update && apt-get upgrade
>
> into two commands:
>
> sudo apt-get update
> apt-get upgrade
>
> Shell parsing happens before the command is executed! You could do
> this:
>
> sudo apt-get update && sudo apt-get upgrade
>
> but then you might get prompted for your password twice.
Ah, I see.
And, I get prompted for password on for the first one only, so this
works. sudo will use the first password for a certain amount of time
before it will ask again, within the same shell.
thanks,
jc
--
Jeff Coppock Systems Engineer
Diggin' Debian Admin and User
Reply to: