13

I am running Ubuntu on a Oracle Vbox in Windows 7 to develop a website. I have a set of directories that have owner read/write permissions but the group www-data does not have rights on the directories.

I tried the command sudo chmod 640 /path-to-directory to change the status, but receive a message requesting my www-data password. My owner level password does not work and I do not know what this password might be.

I tried passwd and receive the message 'changing the password for www-data and a prompt for my current password. When I enter it, I get this error message:

passwd: Authentication token manipulation error
passwd: password unchanged

This error message looks more like some sort of problem on my system, but everything else works fine.

3 Answers 3

20

You're doing it wrong (tm) :)

In your terminal window, look at the "command prompt":

username@hostname:~$

What is username there? You can also try entering whoami[Enter] to see your current username.

From you description it looks like you entered something like

sudo su www-data

or somehow else opened a console session as www-data user. This user has no rights to use sudo command, so your attempts at using sudo fail.

www-data user also has no password set by default, so it is impossible to log in directly as this user. Which is good. You do not want to give it a password.

You need to open another session as your user (or exit your current www-data session) and type the commands there:

sudo chown yourusername:www-data /path/to/directory

which will ask you for your login password.

(or, maybe, just move your stuff to /var/www which already has correct permissions. Then you can add your user to www-data group to get read-write privileges to that directory)

9
  • 1
    Thanks, but I am a bit confused. "whoamI" tells me I am www-data, even in the system directories. So I attempted to switch users and the only name listed is my unix (owner) name, but that is linked to this www-data session. This setup was generated automatically to run a Drupal website and I do not understand the subtleties of Ubuntu. How do I go about logging in with my owner identity? BTW I tried moving the directories to /var/www, but I do not have the authority to do so as www-data.
    – Ashlar
    Apr 21, 2012 at 22:06
  • 1
    Open another terminal window. Type whoami there. Are you still www-data there? I'm not sure what you mean by "unix (owner) name" - what username do you enter when logging in? Is something like "ashlar" or "admin" or is it "www-data"?
    – Sergey
    Apr 21, 2012 at 22:39
  • 1
    I opened a separate question on this here askubuntu.com/questions/124073 and will add responses there.
    – Ashlar
    Apr 21, 2012 at 22:44
  • 1
    My bad. I misunderstood your instructions. I was able to start another terminal session as the owner and make the changes!
    – Ashlar
    Apr 21, 2012 at 22:57
  • 1
    why is it good that you cannot use the www-data user??
    – Toskan
    Aug 4, 2021 at 1:27
3

To allow user www-data to login with WinSCP in a local vmware running ubuntu follow these steps:

  1. Edit the password file

    sudo nano /etc/passwd
    
  2. Alter

    www-data:x:33:33:www-data:/bin:/usr/sbin/nologin
    
  3. to

    www-data:x:33:33:www-data:/var/www:/bin/bash
    
  4. Save.

  5. Set the password for www-data

    sudo passwd www-data
    
  6. You can now login using www-data user.

-1

To change password use this command sudo passwd username ,change username with user you want to set new password,but also you should check ownership and group of particular directory. Use this command ls -l /path/to/file #the third field in the ls -l output is the user and the fourth is the group

You can change group and ownership with chown

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .