All Questions
49
questions
-1
votes
1
answer
52
views
FreeBSD Reverse Shell Command Issue: Ambiguous Output Redirect Error
I’ve been experimenting with penetration testing recently, and I need to use reverse shell techniques for testing. I’ve previously used reverse shell on Ubuntu with the following command:
/bin/bash -i ...
0
votes
3
answers
507
views
Figuring out the time until midnight, and output the result in a text file
How could I make lets say remaining time until tomorrow (midnight, also hours and minutes) and save that to a text file, like for example, "x hours and y minutes remaining until midnight"
...
0
votes
1
answer
82
views
How is this exec command supposed to work in this context?
I'm working through a textbook on UNIX system administration. Chapter 3 of "Unix Third Edition" by a Syed Mansoor.
Chapter 13 has the following example of exec usage which is straightforward ...
7
votes
1
answer
2k
views
mv: rename <oldname> to <newname>/<oldname>: Invalid argument
On my TrueNAS (FreeBSD 13.1) server I have a directory named OldHDD which I want to rename, but I get an error:
% mv OldHDD oldhdd
mv: rename OldHDD to oldhdd/OldHDD: Invalid argument
I have tried ...
0
votes
1
answer
415
views
Run two commands with the same argument, on one line
I need to parse a file line by line and pass a value found in them to 2 commands, in FreeBSD's sh (no other shells can be used).
My plan was to use xargs and su:
whatever_outputs_values | xargs -I {} ...
1
vote
1
answer
293
views
Determine the library or libraries used by the /sbin/init and /bin/sh in FreeBSD
How to determine the library or libraries being used by the /sbin/init and the /bin/sh in FreeBSD? Is it dynamically linked or static?
0
votes
1
answer
734
views
How to source a script code (set a variable) from another shell?
I tried to use FreeBSD.
The FreeBSD root user uses csh by default.
user@freebsd-13:~ $ echo $SHELL
/bin/csh
I know that setting a variable via $() does not work in csh.
root@freebsd-13:~ # export ...
1
vote
1
answer
189
views
FreeBSD - get timezone in Continent/Region format
I have a Linux (bash) script to generate a login message (motd). One of the things it displays is the timezone, using the command timedatectl | grep Time | awk {'print $3'}.
The command returns ...
0
votes
2
answers
75
views
Why the sed command is not replacing the pattern inside a shell script?
I am trying to prepare a shell script to include several chained sed commands.
I am using /bin/sh in FreeBSD 12. Which seems to be POSIX compliant (see man page here).
This is what I have tried, it ...
1
vote
1
answer
435
views
How to insert ESC control characters in a file in FreeBSD?
I want to enclose Fortran comments with two escape commands (ESC+E and ESC+F).
This implies detecting the comment that begins with ! until end of line, and prefixing it with ESC+E and suffixing it ...
0
votes
2
answers
961
views
How to group files from find command into a single line where each file is inside double quotes? [duplicate]
This is a recurrent issue I have always had while dealing with iterations or actions over files found using find.
I have the following files:
$ find . -name "*ES 03-11*"
./01jan/ES 03-11....
2
votes
1
answer
441
views
LightDM is ignoring /etc/login.conf and ~/.login_conf
LightDM is ignoring /etc/login.conf and ~/.login_conf
LightDM is ignoring anything defined /etc/login.conf. Even if I modify it and rebuild the database as instructed, LightDM still does not apply ...
2
votes
1
answer
333
views
How can I prevent Ctrl+C from "going outwards"?
I want to run an interactive tool that can either exit by itself (when the tasks are done) or by me hitting Ctrl+C. In this example, the tool consists of an echo and a sleep (thus it is not really ...
2
votes
1
answer
184
views
Is possible to execute command as root when switched from root to user using su?
Same as topic.
I'm root. Then switch to user1 using
su - user1
Then execute command as root without sudo or suid/chmod. Is it possible?
One person probably did this but tells me it's a magic trick....
2
votes
1
answer
695
views
How to use if on csh FreeBSD from test if file is older then X minutes
I have the following code working in Debian system's:
for File in "${Files[@]}"; do
if test "`find $FolderDownload/$File -cmin -190`" ; then
echo "File is new then 3 hours"
# Set ...