Sponsored Content
Operating Systems Linux Red Hat SFTP User creation in Redhat Linux/UNIX Post 302959114 by taherahmed on Thursday 29th of October 2015 12:59:24 AM
Old 10-29-2015
Hammer & Screwdriver SFTP User creation in Redhat Linux/UNIX

Code:
SFTP user creation step…
  
  Create a group
  # groupadd  sftp_users
  
  If the users doesn’t exist on system , use below command :
# useradd  -G sftp_users  -s /sbin/nologin  username
# passwd username


  For already existing users , use below usermod command :
# usermod –G sftp_users  -s /sbin/nologin  username

  # vi /etc/ssh/sshd_config

#comment out the below line and add a line like below
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp

  # add Below lines  at the end of file
Match Group sftp_users
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory %h
ForceCommand internal-sftp
  
  
  Restart the ssh service
# service sshd restart

For Solaris 10

Code:
In your sshd_config file- make below changes
vi /etc/ssh/sshd_config
  
Match User user 
ChrootDirectory /home/user 
ForceCommand internal-sftp 
AllowTcpForwarding no 
  Esc :wq

Then run:- 
chsh -s /bin/false user 
chown root:root /home/user 
mkdir /home/user/uploads 
chown user /home/user/uploads   

Restart ssh

svcadm disable /network/ssh:default
svcadm enable /network/ssh:default

The user will only be able to write in /home/user/uploads.

Last edited by taherahmed; 10-30-2015 at 02:33 AM.. Reason: Solaris Procedure Added
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Server load (Unix/Linux, Redhat, CPanel)

Hello, I'm facing a big problem with my hosting server (Dual Xeon 2.4GHz), I'm having a load in the CPU usage and the memory (maybe it's related) ALSO mySQL: Server Load 5.34 (2 cpus) (to 22 sometime) Memory Used 68.4 % (to 70% sometime) When I go to 'CPU/Memory/MySQL Usage' I found: ... (3 Replies)
Discussion started by: Kh@lid
3 Replies

2. Shell Programming and Scripting

SFTP vs FTP and going UNIX to LINUX

I have automated an ftp process that FTP's files from one UNIX box to another in the following format: ftp -n -v $REMOTE_SERV << EOF user $FTP_USER $FTP_PASS cd $REMOTE_PATH put $CUR_NAME $NEW_NAME bye But how can I accomplish this SFTPing from a UNIX box to a LINUX box? I've seen... (4 Replies)
Discussion started by: TimBurke
4 Replies

3. Shell Programming and Scripting

File locking (Unix/Linux) & sftp

Hi all, Can anyone help ...on how to ensure that a file is locked . thanks & regards, Soodoo ---------------------------------------- Problem description: - We usually use the mv command in scripts to make sure that a file is complete and not being written to by another process. ... (1 Reply)
Discussion started by: soodoo
1 Replies

4. Red Hat

User creation

Hi Thanks in advance. How to create a user without useradd command ?? (1 Reply)
Discussion started by: krish4linux
1 Replies

5. Shell Programming and Scripting

generic sftp script creation

I am trying to work out if it is possible to create a generic scrip which will allow sftp to be run for connecting to a host machine based on a parameter and to retrieve files based on a batch file. The batch file bit I am fine with, I can make that work. The are I'm not so sure about is how to... (1 Reply)
Discussion started by: mike_p
1 Replies

6. Shell Programming and Scripting

UNIX/Linux User permisions

Hi Guys, I have a program that runs but now everytime the user tries to do chown userid:groupid it fails with operation not permit. I do have root access to the server. How do I grant the user chown priviledge? Please Help !!!!!!!!!!!!! Thanks in advance... (2 Replies)
Discussion started by: Phuti
2 Replies

7. UNIX for Advanced & Expert Users

secure sftp login not working in RedHat Linux

I'm using RedHat Linux 6.1 and wanted to create an user account with only access to single directory. Have followed all the steps from below link and still user is not able to login: How to Setup Chroot SFTP in Linux (Allow Only SFTP, not SSH) (link removed) While the other users, which... (10 Replies)
Discussion started by: asyed
10 Replies

8. Shell Programming and Scripting

Sftp file creation date and time

Hi Team, How to get the file creation date and time in SFTP server we can able to type ls -ltr command only SFTP server. Generally we type ls --full-time test.txt we will get the date and time , same way how to do in SFTP server after connected. Thanks (1 Reply)
Discussion started by: bmk123
1 Replies

9. UNIX for Beginners Questions & Answers

Sftp file creation time

Hi Team, Could you please let me know ,how to find the file creation date time in SFTP server. i tred like , ls -ltr command only availble and not available like ls --full-time test.txt please help? Thanks (7 Replies)
Discussion started by: bmk123
7 Replies

10. UNIX for Beginners Questions & Answers

Linux sftp — how to add new user to access exist directory with write permission?

I have built a website and I can access and edit the website'files on server via the root user. The current file and directory structures are not changeable. Now I am hiring a webpage designer to help me re-design some pages, I am going to let the designer edit the files directly on the server. So... (5 Replies)
Discussion started by: uwo-g-xw
5 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 03:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy