Welcome to the Linux Foundation Forum!

Permissions issue.

Options
xavinux
xavinux Posts: 5
edited November 2011 in System Management

Hi Dear Sirs:

I am having a little problem with permissions of a file, and can´t find a solution,

I have a mail Server with Postfix, Courier and Roundcube as Webmail.

When I give in the user´s directory permissions to root (/maildir/user root:root), login is ok in Roundcube but can´t send mails, and logs show: "/maildir/domain.com/user/tmp/mail_id.server_name: Permission denied)"

If I give in user´s directory permissions to another user, for example mail (/maildir/user mail:mail), I can send mails but can´t login into Roundcube Webmail.

Please excuse me if this is not the correct place for asking for help with this issue.

But I ´ve been looking for a solution for some days but can´t find it.

Any help will be welcome.

Thanks for your attention Sirs.

Best regards,

Javier

Comments

  • mfillpot
    mfillpot Posts: 2,177
    Options
    I have moved the post to the System Management category to help better index the question.

    Have you attempted to review the username being used by reviewing the output of lsof when the the operation is being requested? This can help you to identify the username being used so you can adequately set the permissions.
  • xavinux
    Options
    Thank you very much for your help mfillpot.
    I´ll be testing what I can find with lsof and post what I find.
    Thanks again.

    Best regards
  • xavinux
    xavinux Posts: 5
    edited November 2011
    Options
    This is what I find with lsof:

    lsof -i :143
    COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
    couriertc 2849 root 3u IPv4 7630 TCP mail.server:imap2 (LISTEN)
    couriertc 2849 root 5u IPv4 7631 TCP localhost:imap2 (LISTEN)

    Seems that root is the username being used.
    I´ve changed the courier directory UID and GID to mail:mail but when I do lsof -i :143 still root as the username in used.
    Still can´t find a solution to this issue.
    Thanks again for you attention.
  • mfillpot
    mfillpot Posts: 2,177
    Options
    You are looking at the network traffic rather than the files, you will want to use grep on the output to find the files in the mail directories, once you see the that those are accessed you will be able to locate the application and username used.
  • xavinux
    Options
    Thanks again mfillpot for taking time to answer me.
    Could you please give me an example of how would you combine the lsof with the grep command so as to be able to find those files in the mail directory?
    Thank you very much Sir.
  • mfillpot
    mfillpot Posts: 2,177
    edited November 2011
    Options
    I will gladly give you that infromation. You can pipe the output of any file through grep to limit the output to only the lines that contain your chosen text.

    So in my example I want to see all applications that are using the file /usr/lib/libXrender.so.1.3.0
    matt:~$lsof|grep "/usr/lib/libXrender.so.1.3.0"
    dzen2     2519       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    chrome    2692       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    chrome    2700       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    chrome    2901       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    chrome    2913       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    GoogleTal 2916       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    konsole   3207       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    blender   3666       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    kdeinit4  3908       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    klauncher 3910       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    kded4     3913       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    knotify4  3924       matt  mem       REG        8,5    30712 2532691 /usr/lib/libXrender.so.1.3.0
    

    This is listing the applications in the first column, the username in use in the third column and the file being used in the last column. If you want to learn more about the uses of lsof or grep you can consult their man pages by typing man followed by the application name.
  • xavinux
    Options
    Again, thank you for your kind attention Sir.
    I run these commands but couldn´t obtain the user with permission over this files.
    I run:

    lsof | grep "/maildir/domain.com/user/.Sent/cur/mail_id"

    lsof "/maildir/domain.com/user/.Sent/cur/mail_id" (THIS LINE WITHOUT THE GREP FILTER)

    lsof | grep /maildir/domain.com/user/.Sent/cur/mail_id (THIS LINE WIYHOUT QUOTES)

    lsof /maildir/domain.com/user/.Sent/cur/mail_id (THIS LINE WITHOUT THE GREP FILTER AND WITHOU QUOTES)

    But dont´t tell me anything about the user who is owning this file, although I´m logged as root in the system.
    Thanks for your patience and your help Sir.


Categories

Upcoming Training