How can i make user always create files + folders with 775 permission ? Please help
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have user1 with SFTP+SSH access to a machine.
User1 runs processes and creates files in home/user1/foldername
User2 has FTP only access, no sftp or ssh and is chrooted to home/user1/foldername
Having:
user1:x:1000:user2
user2:x:1001:user1
set in etc/group.
When user1 creates a file in home/user1/foldername, user2 will not be able to modify that file.
I need both user1 & user2 to have read,write&execute(if execute is needed to delete a file) permissions on all files located in home/user1/foldername !BUT! also future files & folders + subfolders that will get created there, for example: home/user1/foldername/newfolder/newfile.txt
Last edited by ParanoiaUser; 12-06-2016 at 02:05 PM.
I see what you mean. And it appears you don't have much grasp of the ownership/permission fundamentals which is alright at the beginning. If you want to become more efficient, you need to understand the concept of it.
You have few issues there:
-
Quote:
I have user1 with SFTP+SSH access to a machine.
Whenever you grant SSH access to a user, it is pointless to setup an SFTP which a lot of users even demand a chrooted setup without realizing that the user has shell access anyway. SCP will do just fine.
- You have haphazardly granted group membership to each other without considering its implication. If you really want a shared resource, why not allocate a separate location with a common group membership?
- It is advisable to create a shared folder outside one's $HOME.
Why don't you start from simple setup and work your way up from there? We're you able to even get past the SFTP setup?
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
listen_ipv6=NO
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=002
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in your local time zone. The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
allow_writeable_chroot=YES
listen_port=30050
pasv_enable=Yes
pasv_max_port=10100
pasv_min_port=10090
chmod_enable=YES
seccomp_sandbox=NO
You dont tell me how to improve it = useless to me, i don't need someone telling me "you can go learn to do this" i need someone to tell me exactly what i need to do to solve this specific problem i've posted about, i don't want to go read hundreds of text lines, if i wanted to do that i wouldnt be here asking for your help.
I believe my problem is Very basic & simple to solve, i am not trying to become a network administrator for NASA you know ? i am asking simple questions here.
Last edited by ParanoiaUser; 12-06-2016 at 03:08 PM.
I believe my problem is Very basic & simple to solve, i am not trying to become a network administrator for NASA you know ? i am asking simple questions here.
No you are not, you are trying to become a network administrator of a ftp sight.
if it is so simple then why are you asking us how to fix it. You NOT wanting to learn how to set up your own system and its software is not very productive on your part.
Like I and another has suggested to set up a directory pool share type setting then set permissions to that parent directory so everybody can play inside of it without destroying others toys.
allowing others to log into someone else home is not a good idea.
You dont tell me how to improve it = useless to me, i don't need someone telling me "you can go learn to do this" i need someone to tell me exactly what i need to do to solve this specific problem i've posted about, i don't want to go read hundreds of text lines, if i wanted to do that i wouldnt be here asking for your help.
I believe my problem is Very basic & simple to solve, i am not trying to become a network administrator for NASA you know ? i am asking simple questions here.
If you don't know jack all about this, then how can you decide "no use"?
Show some gratitude and not attitude.
Last edited by Habitual; 12-06-2016 at 03:46 PM.
Reason: LQ Volunteers
I think you need to read everything again then rethink your attack on this issue you are having. What apps are you going to use, ssh / SFTP / vsftp -if one user has both and another user has only ftp, then screw that other guy with his ssh, and make him only use ftp so the two users can relate properly using the ftp set up. less head ache.
then just set up your ftp sight accordingly.
with a area they both can play in and not have to worry about the other destroying his toys, and visa a versa. Nor being able to do something in someone esles home directory. only a root admin and the user is suppose to be able to get into it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.