Using 'Giveto' to Copy Files and/or Directories to Another User

Article ID: 280
Last updated: 03 Dec, 2025

NAS's in-house developed giveto script is built on the use of Access Control Lists (ACLs). It allows one user (the giver) to copy files and/or directories to a /nobackup directory of another user (the recipient).

giveto is installed under /usr/local/bin on all NAS compute systems and Lou.

In the example below, user zsmith gives a copy of his dir.abc directory on PFEs to user jbrown. The steps describe the giveto command used by each of them, and the results.

  1. User jbrown uses the command giveto -i zsmith to automatically (a) create an INCOMING directory (if it does not already exist) under her /nobackup/jbrown and (b) grant user zsmith read/write/execute permission on this directory.

    
    pfe21:/u/jbrown% giveto -i zsmith
    nobackup[1] =  /nobackup/jbrown
    
    pfe21:/u/jbrown% ls -ld /nobackup/jbrown/INCOMING
    drwxrwx---+ 2 jbrown s0202 4096 Jun 14 12:18 /nobackup/jbrown/INCOMING
    
  2. User zsmith uses the command giveto jbrown dir.abc to automatically (a) create a subdirectory called zsmith_0 under jbrown's INCOMING directory, (b) copy dir.abc to /nobackup/jbrown/INCOMING/zsmith_0, (c) grant user jbrown read/write/execute permission on /nobackup/jbrown/INCOMING/zsmith_0, and (d) send an email to user jbrown regarding the copy.

     
    pfe21:/home1/zsmith> ls -ld dir.abc
    drwx------ 2 zsmith s0101 17 Jun 14 12:21 dir.abc/
    
    pfe21:/home1/zsmith> giveto jbrown dir.abc
    setfacl -m u:jbrown:rwx zsmith_0
    setfacl -m u:jbrown:rwx zsmith_0/giveto.log
    setfacl -m u:jbrown:rwx zsmith_0/dir.abc
    setfacl -m u:jbrown:rwx zsmith_0/dir.abc/foo2
    path =  /nobackup/jbrown/INCOMING/zsmith_0
    total 12
    drwxrwx---+ 3 zsmith  s0101 4096 Jun 14 12:29 .
    drwxrwx---+ 3 jbrown  s0202 4096 Jun 14 12:29 ..
    drwxrwx---+ 2 zsmith  s0101 4096 Jun 14 12:21 dir.abc
    -rw-rwx---+ 1 zsmith  s0101   44 Jun 14 12:29 giveto.log
    

    Note: If the directory zsmith_0 already exists prior to this step, zsmith_1 would be used instead.

  3. User jbrown receives an email from user zsmith with a subject line "giveto files". They see that the directory dir.abc has been copied successfully. Even though the directory /nobackup/jbrown/INCOMING/zsmith_0 is still owned by user zsmith, user jbrown now has permission to read/write/execute files and directories under /nobackup/jbrown/INCOMING/zsmith_0.

     
    pfe21:/u/jbrown% ls -lrt /nobackup/jbrown/INCOMING
    total 4
    drwxrwx---+ 3 zsmith s0101 4096 Jun 14 12:29 zsmith_0
    
    pfe21:/u/jbrown%ls -lrt /nobackup/jbrown/INCOMING/zsmith_0
    total 4
    drwxrwx---+ 2 zsmith s0101 4096 Jun 14 12:21 dir.abc
    
    pfe21:/u/jbrown%ls -lrt /nobackup/jbrown/INCOMING/zsmith_0/dir.abc
    total 4
    -rw-rwx---+ 1 zsmith s0101 8 Jun 14 12:21 foo2
    
    pfe21:/u/jbrown%getfacl /nobackup/jbrown/INCOMING/zsmith_0/dir.abc
    # file: /nobackup/jbrown/INCOMING/zsmith_0/dir.abc
    # owner: zsmith
    # group: s0101
    user::rwx
    user:jbrown:rwx
    group::---
    mask::rwx
    other::---
    

Read man giveto for more information.

The giveto script was created by NAS staff member Arthur Lazanoff.

Contact Us

General User Assistance

Security

  • Report security issues 24x7x365
  • Toll-free: 1-877-NASA-SEC (1-877-627-2732)
  • E-mail: soc@nasa.gov

User Documentation

High-End Computing Capability (HECC) Portfolio Office

NASA High-End Computing Program

Tell Us About It

Our goal is furnish all the information you need to efficiently and effectively use the HECC resources needed for your NASA computational projects.

We welcome your input on features and topics that you would like to see included on this website.

Please send us email with your wish list and other feedback.