Sponsored Content
Full Discussion: Replace string in a file.
Top Forums Shell Programming and Scripting Replace string in a file. Post 303000543 by ghettochild2600 on Friday 14th of July 2017 12:41:29 AM
Old 07-14-2017
I'm quite new to all this so some of my syntax is probably incorrect.

Code:
sudo awk '{sub("</IfModule>", "TLSRequired off", $0); print}' /etc/proftpd/tlsBAK.conf

sed -i 's/</IfModule>/TLSRequired off/g' /etc/proftpd/tlsBAK.conf

sudo sed -i -e 's/\<\//IfModule/>/test/g' /etc/proftpd/tlsBAK.conf

sudo sed -i -e 's/^\/\/\"</IfModule>";/\"TLSRequired off";/' /etc/proftpd/tlsBAK.conf


sudo bash -c 'echo -e "\nTLSRequired off" >> /etc/proftpd/tls.conf'
sudo bash -c 'echo "TLSProtocol TLSv1" >> /etc/proftpd/tls.conf'
sudo bash -c 'echo "TLSRSACertificateFile /etc/webmin/miniserv.pem" >> /etc/proftpd/tls.conf'
sudo bash -c 'echo "TLSRSACertificateKeyFile /etc/webmin/miniserv.pem" >> /etc/proftpd/tls.conf'
sudo bash -c 'echo "TLSCipherSuite HIGH:!ADH:!AES256-SHA:!ECDHE-RSA-AES256-SHA384:!AES128-SHA:!DES-CBC3-SHA:!DES-CBC3-MD5:!IDEA-CBC-SHA:!RC4-MD5:!IDEA-CBC-MD5:!RC2-CBC-MD5:!MD5:!aNULL:!EDH:!AESGCM" >> /etc/proftpd/tls.conf'
sudo bash -c 'echo "TLSVerifyClient off" >> /etc/proftpd/tls.conf'
sudo bash -c 'echo "TLSRenegotiate ctrl 3600 data 512000 required off timeout 300" >> /etc/proftpd/tls.conf'
sudo bash -c 'echo "TLSLog /var/log/proftpd/tls.log" >> /etc/proftpd/tls.conf'
sudo bash -c 'echo "TLSOptions NoSessionReuseRequired" >> /etc/proftpd/tls.conf'
sudo bash -c 'echo -e "\n</IfModule>" >> /etc/proftpd/tls.conf'

</IfModule> is added at the end. Needs to delete the first instance as it is replaced.

# What file currently looks like

</IfModule>

# Added by script
TLSRequired off
TLSProtocol TLSv1
TLSRSACertificateFile /etc/webmin/miniserv.pem
TLSRSACertificateKeyFile /etc/webmin/miniserv.pem
TLSCipherSuite HIGH:!ADH:!AES256-SHA:!ECDHE-RSA-AES256-SHA384:!AES128-SHA:!DES-CBC3-SHA:!DES-CBC3-MD5:!IDEA-CBC-SHA:!RC4-MD5:!IDEA-CBC-MD5:!RC2-CBC-MD5:!MD5:!aNULL:!EDH:!AESGCM
TLSVerifyClient off
TLSRenegotiate ctrl 3600 data 512000 required off timeout 300
TLSLog /var/log/proftpd/tls.log
TLSOptions NoSessionReuseRequired

</IfModule>


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 07-14-2017 at 04:47 AM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How To Replace A String In File With A String Containing Windows File Path

Hi, I have a file with the following contents # Lines that start with a # are comments. # # Calling TOAD like this will perform a comparison from command line : # # "C:\Program Files\Quest Software\Toad for Oracle 9.6\toad.exe" -c... (2 Replies)
Discussion started by: rajan_san
2 Replies

2. Shell Programming and Scripting

Using sed to replace a string in file with a string in a variable that contains spaces

Hi, i call my shell like: my_shell "my project name" my script: #!/bin/bash -vx projectname=$1 sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp cp temp test_config_doxy the following error occurres: sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies

3. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

4. UNIX for Dummies Questions & Answers

Search a string in the file and then replace another string after that position

Hi I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall: E.g: Actual File content: Hello Name: Nitin Raj Welcome to Unix... (4 Replies)
Discussion started by: dashing201
4 Replies

5. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

6. Shell Programming and Scripting

How to read file, and replace certain string with another string?

Hi all, the value in the following file is just an example. It could be a different value/network addresses. Here is my example of initial output in a file name net.txt Initial Output, net.txt The goal is to produce the following format which is to convert from CIDR to Netmask... (6 Replies)
Discussion started by: type8code0
6 Replies

7. UNIX for Dummies Questions & Answers

Search for a string,delete the line and replace with new string in a file

Hi Everyone, I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file. I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies

8. Shell Programming and Scripting

Replace string in XML file with awk/sed with string from another

Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file: </member> <member> <name>TransactionID</name> <value><string>123456789123456</string></value> </member> <member> <name>Number</name> ... (9 Replies)
Discussion started by: cozzin
9 Replies

9. Shell Programming and Scripting

Replace string of a file with a string of another file for matches using grep,sed,awk

I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: --> cat comp.pkglist Package list: nss-util-devel-3.28.4-1.el6_9.x86_64 Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies

10. UNIX for Beginners Questions & Answers

Search partial string in a file and replace the string - UNIX

I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this. string(Scenario 1)- user::r--,user::ourfrd:r-- String(Scenario 2)- user::r-- File **** # file: /local/Desktop/myfile # owner: me # group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
proftpd(8)                                                    System Manager's Manual                                                   proftpd(8)

NAME
proftpd - Professional configurable, secure file transfer protocol server SYNOPSIS
proftpd [ -hlntv ] [ -c config-file ] [ -d debuglevel ] [ -p 0|1 ] DESCRIPTION
proftpd is the Professional File Transfer Protocol (FTP) server daemon. The server may be invoked by the Internet "super-server" inetd(8) each time a connection to the FTP service is made, or alternatively it can be run as a standalone daemon. When proftpd is run in standalone mode and it receives a SIGHUP then it will reread its configuration file. When run in standalone mode without the -n option, the main proftpd daemon writes its process ID to /var/run/proftpd.pid to make it easy to know which process to SIGHUP. OPTIONS
-h,--help Display a short usage description, including all available options. -n,--nodaemon Runs the proftpd process in standalone mode (must be configured as such in the configuration file), but does not background the process or disassociate it from the controlling tty. Additionally, all output (log or debug messages) are sent to stderr, rather than the syslog mechanism. Most often used with the -d option for debugging. -q,--quiet Quiet mode; don't send logging information to standard error when running with the -n option. -v,--version Displays the version number of ProFTPD to stdout. -D,--define parameter Sets a configuration parameter which can be used <IfDefine>...</IfDefine> sections in the configuration files to conditionally skip or process commands. -d,--debug debuglevel Sets proftpd's internal debug level (normally 0). The debuglevel should be an integer value from 0 to 10, with higher numbers producing more debug output. Normally, debug messages are sent to syslog using the DEBUG facility, however if the -n option is used, all such output is sent to stderr. -c,--config config-file Specifies an alternate config-file to be parsed at startup, rather than the default configuration file. The default configura- tion file is /etc/proftpd/proftpd.conf -N,--nocollision Disables address/port collision checking. -V,--settings Displays various compile-time settings and exits. -S,--serveraddr Specifies an IP address for the host machine, avoiding an DNS lookup of the hostname -t,--configtest Read the configuration file, report any syntax errors, and exit. -p,--persistent 0|1 Disables (0) or enables (1) the default persistent password support, which is determined at configure time for each platform. This option only affects the default support, it can still be overridden at run-time with the PersistentPasswd directive. -l,--list Lists all modules compiled into proftpd. -4,--ipv4 Support IPv4 functionality only, regardless of whether the --enable-ipv6 configure option was used. -6,--ipv6 Support IPv6 connections and lookup of IPv6 addresses for server DNS names. This is enabled by default, if the --enable-ipv6 configure option is used. FILES
/usr/sbin/proftpd /etc/proftpd/proftpd.conf /usr/bin/ftpwho /usr/bin/ftpcount /usr/bin/ftptop /usr/sbin/ftpshut /var/log/xferlog /var/run/proftpd.pid /var/run/proftpd.scoreboard AUTHORS
ProFTPD is written and maintained by a number of people, full credits can be found on http://www.proftpd.org/credits.html SEE ALSO
inetd(8),ftp(1),ftpwho(1),ftpcount(1),ftpshut(8) Full documentation on ProFTPD, including configuration and FAQs, is available at http://www.proftpd.org/ For help/support, try the ProFTPD mailing lists, detailed on http://www.proftpd.org/lists.html Report bugs at http://bugs.proftpd.org/ July 2000 proftpd(8)
All times are GMT -4. The time now is 05:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy