Skip to main content
updated script - better stability
Source Link
FelixJN
  • 14.1k
  • 2
  • 36
  • 55

Users have the right to set ACLs for their own files.

To allow john to "send" a file only to as specific user (joe), simply make john execute e.g.:

setfacl -m u:joe:rw file

For allowing user joe to access the file. Of course the standard permissions would have to exclude access by joe (i.e. joe not being group member of group john and no access permission to others). Set the setfacl command to your liking and if you want to make a "send" command with a simple script, here would be a suggestion:

#!/bin/bash

print_help(){
  echo "Usage: sendfile -u <user> file1 file2 ..."
  exit 1
}

while getopts "u:h" option
do
  case $option in
    u) user=$OPTARG
       if [[ "$(grep ^${user}: /etc/passwd)" == "" ]]
       then
         echo "$user not a valid user."
         exit
       fi ;; 
    h) print_help ;;
    *) print_help ;;
  esac
done 


if ((OPTIND == 1))
then
    echo "No user specified"
    exit 1
fi

shift $((OPTIND - 1))

echo setfacl u:${user}:rw $*"$@"

Of course ACLs need to be enabled in the first place.

Users have the right to set ACLs for their own files.

To allow john to "send" a file only to as specific user (joe), simply make john execute e.g.:

setfacl -m u:joe:rw file

For allowing user joe to access the file. Of course the standard permissions would have to exclude access by joe (i.e. joe not being group member of group john and no access permission to others). Set the setfacl command to your liking and if you want to make a "send" command with a simple script, here would be a suggestion:

#!/bin/bash

print_help(){
  echo "Usage: sendfile -u <user> file1 file2 ..."
  exit 1
}

while getopts "u:h" option
do
  case $option in
    u) user=$OPTARG
       if [[ "$(grep ^${user}: /etc/passwd)" == "" ]]
       then
         echo "$user not a valid user."
         exit
       fi ;; 
    h) print_help ;;
    *) print_help ;;
  esac
done 


if ((OPTIND == 1))
then
    echo "No user specified"
    exit 1
fi

shift $((OPTIND - 1))

echo setfacl u:${user}:rw $*

Of course ACLs need to be enabled in the first place.

Users have the right to set ACLs for their own files.

To allow john to "send" a file only to as specific user (joe), simply make john execute e.g.:

setfacl -m u:joe:rw file

For allowing user joe to access the file. Of course the standard permissions would have to exclude access by joe (i.e. joe not being group member of group john and no access permission to others). Set the setfacl command to your liking and if you want to make a "send" command with a simple script, here would be a suggestion:

#!/bin/bash

print_help(){
  echo "Usage: sendfile -u <user> file1 file2 ..."
  exit 1
}

while getopts "u:h" option
do
  case $option in
    u) user=$OPTARG
       if [[ "$(grep ^${user}: /etc/passwd)" == "" ]]
       then
         echo "$user not a valid user."
         exit
       fi ;; 
    h) print_help ;;
    *) print_help ;;
  esac
done 


if ((OPTIND == 1))
then
    echo "No user specified"
    exit 1
fi

shift $((OPTIND - 1))

setfacl u:${user}:rw "$@"

Of course ACLs need to be enabled in the first place.

added 56 characters in body
Source Link
FelixJN
  • 14.1k
  • 2
  • 36
  • 55

Users have the right to set ACLs for their own files.

To allow john to "send" a file only to as specific user (joe), simply make john execute e.g.:

setfacl -m u:joe:rw file

For allowing user joe to access the file. Of course the standard permissions would have to exclude access by joe (i.e. joe not being group member of group john and no access permission to others). Set the setfacl command to your liking and if you want to make a "send" command with a simple script, here would be a suggestion:

#!/bin/bash

print_help(){
  echo "Usage: sendfile -u <user> file1 file2 ..."
  exit 1
}

while getopts "u:h" option
do
  case $option in
    u) user=$OPTARG
       if [[ "$(grep ^${user}: /etc/passwd)" == "" ]]
       then
         echo "$user not a valid user."
         exit
       fi ;; 
    h) print_help ;;
    *) print_help ;;
  esac
done 


if ((OPTIND == 1))
then
    echo "No user specified"
    exit 1
fi

shift $((OPTIND - 1))

echo setfacl u:${user}:rw $*

Of course ACLs need to be enabled in the first place.

Users have the right to set ACLs for their own files.

To allow john to "send" a file only to as specific user (joe), simply make john execute e.g.:

setfacl -m u:joe:rw file

For allowing user joe to access the file. Of course the standard permissions would have to exclude access by joe (i.e. joe not being group member of group john and no access permission to others). Set the setfacl command to your liking and if you want to make a "send" command with a simple script, here would be a suggestion:

#!/bin/bash

print_help(){
  echo "Usage: sendfile -u <user> file1 file2 ..."
  exit 1
}

while getopts "u:h" option
do
  case $option in
    u) user=$OPTARG
       if [[ "$(grep ^${user}: /etc/passwd)" == "" ]]
       then
         echo "$user not a valid user."
         exit
       fi ;; 
    h) print_help ;;
    *) print_help ;;
  esac
done 


if ((OPTIND == 1))
then
    echo "No user specified"
    exit 1
fi

shift $((OPTIND - 1))

echo setfacl u:${user}:rw $*

Users have the right to set ACLs for their own files.

To allow john to "send" a file only to as specific user (joe), simply make john execute e.g.:

setfacl -m u:joe:rw file

For allowing user joe to access the file. Of course the standard permissions would have to exclude access by joe (i.e. joe not being group member of group john and no access permission to others). Set the setfacl command to your liking and if you want to make a "send" command with a simple script, here would be a suggestion:

#!/bin/bash

print_help(){
  echo "Usage: sendfile -u <user> file1 file2 ..."
  exit 1
}

while getopts "u:h" option
do
  case $option in
    u) user=$OPTARG
       if [[ "$(grep ^${user}: /etc/passwd)" == "" ]]
       then
         echo "$user not a valid user."
         exit
       fi ;; 
    h) print_help ;;
    *) print_help ;;
  esac
done 


if ((OPTIND == 1))
then
    echo "No user specified"
    exit 1
fi

shift $((OPTIND - 1))

echo setfacl u:${user}:rw $*

Of course ACLs need to be enabled in the first place.

Source Link
FelixJN
  • 14.1k
  • 2
  • 36
  • 55

Users have the right to set ACLs for their own files.

To allow john to "send" a file only to as specific user (joe), simply make john execute e.g.:

setfacl -m u:joe:rw file

For allowing user joe to access the file. Of course the standard permissions would have to exclude access by joe (i.e. joe not being group member of group john and no access permission to others). Set the setfacl command to your liking and if you want to make a "send" command with a simple script, here would be a suggestion:

#!/bin/bash

print_help(){
  echo "Usage: sendfile -u <user> file1 file2 ..."
  exit 1
}

while getopts "u:h" option
do
  case $option in
    u) user=$OPTARG
       if [[ "$(grep ^${user}: /etc/passwd)" == "" ]]
       then
         echo "$user not a valid user."
         exit
       fi ;; 
    h) print_help ;;
    *) print_help ;;
  esac
done 


if ((OPTIND == 1))
then
    echo "No user specified"
    exit 1
fi

shift $((OPTIND - 1))

echo setfacl u:${user}:rw $*