LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-01-2015, 08:50 PM   #1
HardenedCriminal
Member
 
Registered: May 2015
Posts: 104

Rep: Reputation: Disabled
Restrict Proftp users via "ALLOW ..."


I am trying to determine the IP of my dynamic Proftp users and then only allow their IP addresses access.

My problem is I can't get the first SED line to work to delete out all the old values first before putting in the new ones. Thanks to all in advance.

===========================================

#!/bin/bash
# declare an array called array and define values
array=(
someone.noip.com \
someoneelse.noip.com \
etc.noip.com \
)

for I in "${array[@]}"
do

IP=`host $I | awk '{print $4}'` # Gets the IP address of each in array

echo $IP
sed -i '/$a$I/d' /etc/proftpd.d/allowedIPusers.conf # delete out old values BUT DOESN'T WORK!
sed -i "8i Allow $a$IP #$a$I" /etc/proftpd.d/allowedIPusers.conf # insert after line 8

done
exit

Last edited by HardenedCriminal; 07-01-2015 at 08:51 PM.
 
Old 07-01-2015, 08:52 PM   #2
HardenedCriminal
Member
 
Registered: May 2015
Posts: 104

Original Poster
Rep: Reputation: Disabled
Not thinking...
---------------------------------------
#!/bin/bash
sed -i '/noip/d' /etc/proftpd.d/allowedIPusers.conf # delete out old values first and start clean

# declare an array called array and define values
array=(
someone.noip.com \
someoneelse.noip.com \
etc.noip.com \
)

for I in "${array[@]}"
do

IP=`host $I | awk '{print $4}'` # Gets the IP address of each in array

echo $IP
sed -i "8i Allow $a$IP #$a$I" /etc/proftpd.d/allowedIPusers.conf # insert after line 8

done
exit

Last edited by HardenedCriminal; 07-02-2015 at 06:35 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Samba on Fedora 10.10. Originator of docs "owns" it. Other users to share "save as" worded Linux - Newbie 1 03-10-2011 11:23 AM
How do I disable "shutdown" and "restart" options in KDE logout screen for all users? maxgsp Linux - Distributions 1 12-12-2008 03:18 PM
CVS: Can I restrict the "cvs remove" to specific users? CaptainRandom Linux - Software 4 01-13-2005 03:53 PM
"adduser" not adding users to default group "users" PunkPT Slackware 2 09-23-2004 11:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration