linux – How do I copy a directory from one to another BUT preserving directory structure and only use soft symlink for the files?

With reference to this…

/var/web/site/123/(everything inside) to /var/web/site/234/(everything from 123 BUT files are soft symlinked only)

how can this be done using 1 line? i dont want to save to another file etc and the directory input needs to be full directory /var/web/site/123 and not relative directory ./

Copy folder structure (without files) from one location to another

Any takers on this? Using linux command line.

Rational for doing so:

The origin directory “123” is the default pristine work directory to clone new user’s directory “234” to work from. So any new users, when they create their working directory, they can get from the original directory to carry on new work on their own directory.

active directory – vsftpd Authenticating FTP server against Windows AD server not working Ubuntu

I’m trying to authenticate vsftpd on an Ubuntu server against my Active directory server. I have joined the domain successfully following this article:
I can login normally to the linux system. I then installed vsftpd on my Ubuntu 20. Now I can access the FTP server normally using the local users, but when using AD users I get an error: “530 Login incorrect.”. Below I will add my vsftpd, pam and sssd conf, any help would be highly appreciated guys.



Here are the SSD conf:

services = nss, pam
config_file_version = 2
domains = server.local

entry_negative_timeout = 0
#debug_level = 5

#debug_level = 5

#debug_level = 10
enumerate = false
id_provider = ad
auth_provider = ad
chpass_provider = ad
access_provider = ad
dyndns_update = false
ad_hostname = client1.server.local
ad_server = dc02.server.local
ad_domain = server.local
ldap_schema = ad
ldap_id_mapping = true
fallback_homedir = /home/%u
default_shell = /bin/bash
ldap_sasl_mech = gssapi
ldap_sasl_authid = CLIENT1$
krb5_keytab = /etc/sssd/my-keytab.keytab
ldap_krb5_init_creds = true

Here are the pam common-session conf:

session [default=1]

session requisite 

session required  

session optional  

session required
session required skel=/etc/skel/ umask=0022
session optional   
session optional 
# end of pam-auth-update config

Thanks for taking the time in reading this.

Understrap theme translation directory issue

I have my language translation and fa_IR.po and understrap.pot files in theme languages directory. but theme does’nt use them.instead it uses translation in directory:

also there is load_theme_textdomain( 'understrap', get_template_directory() . '/languages' ); in theme setup, so i expected it to load translation mo file from theme languages directory,but its not.

media – How to change upload directory based on frontend form input name or ID?

I created a frontend form using a plugin which allows logged in users to create draft posts. There are 3 file upload areas. I need 1 of them to use the default public WP media upload folder as usual. But I need the files uploaded via 2nd and 3rd file upload areas to move to a restricted sub folder inside the default WordPress file upload folder. 1 of them allow multiple file uploads.

Important facts:

  1. I have changed the default WP_CONTENT folder and UPLOADS folder using wp-config.php
  2. One of the file upload areas allows multiple file uploads

I’m new to WordPress. I looked around to find an exact solution to my issue. there are a few solution but I not exactly what I’m looking for. Thank you very much.

bash – why is the CRLF missing from each line when a directory listing is stored as a variable?

In Ubuntu 20.04, when I run this command, I get this result:

On the CLI:

#find /home/ftpusers/ -name '*.jpg' -type f -printf '%p %u %TY%Tm%Td%TH%TM%.2TSn' | sort --stable --reverse --key=3,4

yields: (Perfect!)

/home/ftpusers/1800wls1/1800WLS610Entry_20200505055737010_GH53J.jpg 5501 20200505115737
/home/ftpusers/1800wls1/1800WLS610Entry_20200505055453330_0207.jpg 5501 20200505115453
/home/ftpusers/1800wls1/1800WLS610Entry_20200505055033850_FPM3494.jpg 5501 20200505115034
/home/ftpusers/1800wls1/1800WLS610Entry_20200505054800520_MKR1529.jpg 5501 20200505114801
/home/ftpusers/1800wls1/1800WLS610Entry_20200505054755850_C0NTRACT.jpg 5501 20200505114755
/home/ftpusers/1800wls1/1800WLS610Entry_20200505054501710_HYY8462.jpg 5501 20200505114501

But in a script when I try to capture the output of the same command, the CRLF gets left off and all data gets lumped into one line without a CRLF.

Like so:

files=$(find /home/ftpusers/ -name '*.jpg' -type f -printf '%p %u %TY%Tm%Td%TH%TM%.2TSn' | sort --stable --reverse --key=3,4)

echo $files


/home/ftpusers/1800wls1/1800WLS610Entry_20200505045623550_J4171.jpg 5501 20200505105624 /home/ftpusers/1800wls1/1800WLS610Entry_20200505044851810_C0NTRACT
.jpg 5501 20200505104852 /home/ftpusers/1800wls1/1800WLS610Entry_20200505044440130_7731.jpg 5501 20200505104441 /home/ftpusers/1800wls1/1800WLS610Entry_20200
505044243730_CC4480.jpg 5501 20200505104244 /home/ftpusers/1800wls1/1800WLS610Entry_20200505043703450_55L07.jpg 5501 20200505103707 /home/ftpusers/1800wls1/1
800WLS610Entry_20200505041813080_MJ4465.jpg 5501 20200505101814 /home/ftpusers/1800wls1/1800WLS610Entry_20200505041115600_C0NTRACT.jpg 5501 20200505101118 /h
ome/ftpusers/1800wls2/1800WLSSanFelipeExit_20200504212713750_CMV72.jpg 5502 20200505022717 /home/ftpusers/1800wls2/1800WLSSanFelipeExit_20200504212634020_BH7
X433.jpg 5502 20200505022640 /home/ftpusers/1800wls2/1800WLSSanFelipeExit_20200504211114600_LTM4327.jpg 5502 20200505021117 /home/ftpusers/1800wls2/1800WLSSa
nFelipeExit_20200504211021870_67225Y9.jpg 5502 20200505021027

How can I retain the CRLF? I need to process one line at a time.

I have even tried this:

find /home/ftpusers/ -name '*.jpg' -type f -printf '%p %u %TY%Tm%Td%TH%TM%.2TSn' | sort --stable --reverse --key=3,4 > /tmp/filelist
files=$(cat /tmp/filelist)
filecount=$(echo $files | wc -l)
echo $files

When executed, $filecount = 1 (as in all of that data is only one line!) and the echo of $files yields one line of data all lumped together.

Thanks in advance!

bash – Script that chooses one subdirectory in directory

Need to choose subdirectory in directory to use it.

I see it in this way.

  1. This is /SampleDir/ and it has /SubDir1/, /SubDir2/ and /SubDir3/

  2. User enter the directory location, program search it and give to user list of SubDirectories in this Dir, user choose with exactly subdir he want to work just click the number of list:

  3. Code

echo "–°hoose Directory:n"
//  #check nubmber of subdirs
echo "In directory you have multiple subdir's, which one do you want to use"
// #choose subdir
// #Any operation, like Remove SubDir
  1. And same in Terminal

Choose Directory:

root@sampleuser:# /root/Documents/SampleDir/

In directory you have multiple subdir’s, which one do you want to use:




root@sampleuser:# 1

Thanks a lot

pam – Ubuntu Vsftpd with active directory ldap but limit the authentication to the FTP service and not the system itself

I’m using SSSD and Pam along with realm to have my active directory users be able to access vsftpd server. The problem is, that the users can access the Ubuntu server itself as well, using the same credentials.
Is there any way to separate the two? Grant access to the AD users only against the FTP service and not the whole system?
I have been researching this for awhile, but coming up empty. Any help on this, would be highly appreciated guys.

Active directory users can access vsftpd (FTP) but not the actual1 system

I’m using SSSD and Pam along with realm to have my active directory users FTP access on my Ubuntu 20 server.
The problem is, that after joining the domain, those users can login to the system itself and not just the FTP server.
I’m new to Linux, is there a way to have my domain users access the FTP server with their active directory credentials, but not have system access?
Any help would be highly appreciated on the subject!

theming – Referencing images in files directory from twig template

In a newly installed Drupal 9 site, I have images in the sites/default/files/ directory which I am trying to use in my custom theme.
In my theme, I’m implementing a custom entity-print–node–deal.html.twig template which is where I am attempting to output one of the images using the it’s path as src in an img tag.

That template is for PDF version of my deal node type to give users a bespoke and nice printing experience including text and properly laid out images.

My issue is the tag is broken on the PDF. I confirmed the uri of the taget is accurate.

In addition, I tested if images can actually display on my PDF by using the URI of an image on the internet. I created another image using the external uri as src and it displayed successfully on my PDF.

My template code is below:

<div id='container'>

    <div id='content'>
        Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
        Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it 
        to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. 
        It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, 
        and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    {% set imgUrl = url('<front>')('#markup') ~ 'sites/default/files/TwitterHeaderPhoto.png' %}
    <b>Url check:</b> {{ imgUrl }}

    <img src="{{ imgUrl }}"/>
    <img src=''/>


And here is an image showing the output including the problem:
enter image description here

I need help figuring this one out, please.