Find the answer to your Linux question:
Results 1 to 2 of 2
I have an access problem with Samba. When my code below tries to move a file to a share on Samba I get an Access is denied error My code ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2005
    Posts
    2

    Samba Share - Access Denied


    I have an access problem with Samba. When my code below tries to move a file to a share on Samba I get an Access is denied error

    My code uses the

    BOOL CServiceHusk::MoveFileEx(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName,DWORD dwFlags) {

    dwFlags |= MOVEFILE_WRITE_THROUGH;


    DebugMsg("Copying DACL");
    // move doesn't change permissions on file, so change them before transfer, then
    // permissions are appropriate to target directory immediately on arrival
    const CString & lpDir = GetJustPath(lpNewFileName);

    if ( !CopyDACL(lpDir, lpExistingFileName) ) // set file permissions to those of directory
    {
    DebugMsg("Failed to copy DACL");


    LogEvent(EVMSG_MOVE_ERROR,
    lpExistingFileName,
    lpNewFileName,
    GetErrorMessage( GetLastError(), true ) );
    return FALSE;

    }

    if (dwFlags & MOVEFILE_COPY_ALLOWED)
    {
    dwFlags ^= MOVEFILE_COPY_ALLOWED;

    DebugMsg("Attempting to move without COPY attribute %s -> %s", lpExistingFileName, lpNewFileName);

    //IT FAILS HERE RETURNING ACCESS DENIED

    if ( !::MoveFileEx(lpExistingFileName, lpNewFileName,
    dwFlags) )
    {
    if ( GetLastError() != 17 ) // Only interested
    in connot move to
    {
    // a diferent disk error
    DebugMsg("Failed to move %s -> %s,
    GetLastError -> %s", lpExistingFileName, lpNewFileName, GetErrorMessage( GetLastError(), true ));


    LogEvent(EVMSG_MOVE_ERROR,
    lpExistingFileName,
    lpNewFileName,
    GetErrorMessage(
    GetLastError(), true ) );
    return FALSE;

    }


    This is a snippet of my smb.conf file is

    [EDG$]
    comment = Share point for EDG Files
    path = /bvnw01/apsroot/MC/transactions/EDG
    public = no
    writable = yes
    printable = no
    create mask = 0660
    directory mask = 0770
    directory security mask = 0770
    browsable = yes
    hosts allow = 111.111.111.1
    hosts deny = ALL
    mangled names = no
    follow symlinks = no
    force create mode = 0660
    force directory mode = 0770
    force directory security mode = 0770
    invalid users = root admin # more users can be added
    map archive = no
    map hidden = no
    security mask = 0660
    valid users = ftms

    #####################
    #default settings
    #####################

    guest ok = no
    admin users =
    max connections = 0
    case sensitive = no
    preserve case = yes
    short preserve case = yes
    mangle case = no
    locking = no
    force user =
    map system = no
    only user = no

    The Samba server is a member of a domain. If I use
    [EDG$]
    comment = Share point for EDG Files
    path = /bvnw01/apsroot/MC/transactions/EDG
    guest ok = yes

    It works. Please help.

    Is there anything on the UNIX end or the NT end that I need to sort out? The Samba server is a member of a domain, not PDC.

  2. #2
    Linux Engineer
    Join Date
    Nov 2004
    Location
    Montreal, Canada
    Posts
    1,267
    Please read the forums rules about double posting
    \"Meditative mind\'s is like a vast ocean... whatever strikes the surface, the bottom stays calm\" - Dalai Lama
    \"Competition ultimatly comes down to one thing... a loser and a winner.\" - Ugo Deschamps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •