Sponsor for PC Pals Forum

Author Topic: Basic Linux Commands & Malicious Commands to watch out for...  (Read 13918 times)

Offline sam

  • Administrator
  • *****
  • Posts: 19977
xkill Kills a running program
exit Exits the terminal
reboot Reboots the system
halt Shutsdown the computer
startx Starts xwindows from terminal
man man(command)shows help files
info info(command) shows help files
--help (command)--help shows help files
su Allow you to login as Super User

ls "Lists" the contents of the directory
pwd Displays "present working directory"
cd cd (name) change directory TO:(name)
mkdir mkdir (name) Makes new directory
rmdir rmdir (name) Removes directory
clear Clears the terminal window

date Displays current date and time
cal Displays a calander
uptime Displays time since last reboot
df Displays the disk usage on partitions
du Displays disk usage of directory

id Displays your identification to system
groups Displays groups of current user
ulimit -a Displays users limits
uname Displays name of machine logged into
who Displays "who" is logged on the system
w Similar to "who"

wall Sends message to all logged in users
top Displays cpu processes memory etc
ps Displays current running processes
« Last Edit: April 20, 2008, 22:55 by sam »
- sam | @starrydude --

Offline sam

  • Administrator
  • *****
  • Posts: 19977
Malicious Commands to watch out for...
« Reply #1 on: April 04, 2008, 08:40 »
Taken from the Ubuntu Forums:

Quote
I'd like to take a moment of your time to discuss a recent disturbing trend the staff has been noticing on the forums, and also take this as an opportunity to raise awareness of this situation through education.

We've recently had an increase in the number of dangerous commands being posted on the forums. Don't pretend you don't know what I mean -- commands that cause massive damage or disruption to the user's computer.

I'd just like to caution those thinking of doing this that UbuntuForums has a strict zero-tolerance policy when it comes to posting dangerous commands. If you post one of them, particularly in a support thread disguised as advice, expect to be instantly and permanently BANNED, at the account, e-mail, IP, or ISP level. I do not care about intent -- if you mean it as a joke, it is not funny. If you mean it as a lesson, go teach it somewhere else. This behavior is absolutely against the Forum Guidelines and Ubuntu Code of Conduct.

I'd also like to remind users to be cautious when someone tells you to run some command or download some script as a solution to your problem. When in doubt as to the safety of the procedure, it's always a good idea to wait for more opinions, and/or have the command explained to you and verify if the explanation makes sense by consulting readily available documentation on Linux commands (such as manpages). No matter how hard we try to stay on top of all posts in realtime, we are not perfect.



Regards,

The UbuntuForums Staff.


For the full and very interesting article: http://ubuntuforums.org/announcement.php?a=54
- sam | @starrydude --

Offline Rik

  • Former Admin
  • *****
  • Posts: 26506
  • Ceud mille failte
Re: Malicious Commands to watch out for...
« Reply #2 on: April 04, 2008, 10:18 »
Nice to see the forum admin stepping in to protect users.
Slainthe!

Rik

Offline sam

  • Administrator
  • *****
  • Posts: 19977
Re: Malicious Commands to watch out for...
« Reply #3 on: April 04, 2008, 10:35 »
and thats one hell of a quick 2000 posts Rik! :-D
- sam | @starrydude --

Offline Rik

  • Former Admin
  • *****
  • Posts: 26506
  • Ceud mille failte
Re: Malicious Commands to watch out for...
« Reply #4 on: April 04, 2008, 10:39 »
You should come over to out place - I'm much faster there. ;)
Slainthe!

Rik

Offline sam

  • Administrator
  • *****
  • Posts: 19977
Re: Malicious Commands to watch out for...
« Reply #5 on: April 04, 2008, 17:05 »
ive taken a look (and it looks very lively!) but not being an "idnetter" I decided against it.. "42260" now thats impressive and I beat they aren't all about sheep like Clive's! (he isn't here, I bet you he won't notice this one..)
- sam | @starrydude --

Offline Rik

  • Former Admin
  • *****
  • Posts: 26506
  • Ceud mille failte
Re: Malicious Commands to watch out for...
« Reply #6 on: April 04, 2008, 17:17 »
He's probably got a search permanently set up for his name. ;)
Slainthe!

Rik

Offline Simon

  • Administrator
  • *****
  • Posts: 77921
  • First to score 7/7 in Quiz of The Week's News 2017
Re: Malicious Commands to watch out for...
« Reply #7 on: April 04, 2008, 20:40 »
You can see how he builds up his posts, Sam - every thread is hijacked with prattle!   :devil: ;D

Going back to the original post, excuse my ignorance, but do those commands affect Windows users as well?   :(
Many thanks to all our members, who have made PC Pals such an outstanding success!   :thumb:

Offline sam

  • Administrator
  • *****
  • Posts: 19977
Re: Malicious Commands to watch out for...
« Reply #8 on: April 04, 2008, 21:56 »
not these exact ones, but there are similar ones that could happen in DOS, or the command prompt (thats what its called in XP I think).
Normally though, windows users are kinda blinded never to use the command prompt so its probably not the same threat. Its really not a threat to most linux users, but for the blind ones who are just copying commands off a forum to get some software to work - then well, it could be pretty bad. Its pretty good to know these things and be aware not to trust everything. Thats the pretty standard line we spout anyway for computer security. There is also nothing new about these commands, the problem is the level that users are now out when allowed to play with the command line.. as that legendary figure once said "education, education, education"...  :devil:

hope that makes sense... I've been programming for the last 6 hours...
- sam | @starrydude --

Offline Simon

  • Administrator
  • *****
  • Posts: 77921
  • First to score 7/7 in Quiz of The Week's News 2017
Re: Malicious Commands to watch out for...
« Reply #9 on: April 04, 2008, 22:20 »
Indeed, and there was me thinking Linux was invincible!   :devil:
Many thanks to all our members, who have made PC Pals such an outstanding success!   :thumb:

Offline sam

  • Administrator
  • *****
  • Posts: 19977
Re: Malicious Commands to watch out for...
« Reply #10 on: April 04, 2008, 22:23 »
well it is, but its all about the user. If you never used the command line in linux, though some packages would be hard to install.. it would be fairly invicible. Like everything the power is in your hands... use the force well.
- sam | @starrydude --

Offline sam

  • Administrator
  • *****
  • Posts: 19977
Re: Malicious Commands to watch out for...
« Reply #11 on: April 04, 2008, 22:26 »
and have you ever seen the graphics in linux? I should post a movie of compiz.. I didn't have this on my old machine but since I made my main machine ubuntu with a swish graphics card it is absolutely brill (kicks vista's ass!) ... oh here is a good page: http://www.ubuntuvideo.com/ubuntu_beryl_vs_windows_vistas_aero (its beryl not compiz, compiz is better)
« Last Edit: April 05, 2008, 13:06 by sam »
- sam | @starrydude --

Offline Simon

  • Administrator
  • *****
  • Posts: 77921
  • First to score 7/7 in Quiz of The Week's News 2017
Re: Malicious Commands to watch out for...
« Reply #12 on: April 04, 2008, 23:42 »
Yes, I've seen that somewhere before, Sam, and I can't dispute, it looks impressive.
Many thanks to all our members, who have made PC Pals such an outstanding success!   :thumb:

Offline mistybear

  • Forum Fanatic
  • ******
  • Posts: 7656
Re: Malicious Commands to watch out for...
« Reply #13 on: April 05, 2008, 11:33 »
Very impressive indeed.  :)
Those who can make you believe absurdities,
can make you commit atrocities.

Offline sam

  • Administrator
  • *****
  • Posts: 19977
Taken from: http://linux.dsplabs.com.au/chmod-invalid-mode-dealing-with-a-leading-minus-in-filenames-under-linux-shell-p37/

Dealing with files whose filenames contain special shell characters can be tricky. Unless you know how to handle their filenames properly, you may not be able to perform even simple operations on such files. In this post I&#8217;ll show you how to deal with files starting with the minus (-) character, as well as with files that contain spaces. Let us consider a simple example. I&#8217;ll start with a pdf file <code>outline.pdf</code> and rename it so that the resulting filenames start with special shell characters.

OK, running
ls -la

produces the following output

total 2308
drwx------ 2 kamil kamil   4096 Nov 26 19:17 .
drwx------ 3 kamil kamil   4096 Nov 26 19:13 ..
-rw------- 1 kamil kamil 465135 Nov 26 19:14 ~ outline.pdf
-rw------- 1 kamil kamil 465135 Nov 26 19:16 ~outline.pdf
-rw------- 1 kamil kamil 465135 Nov 26 19:15 -outline.pdf
-rw------- 1 kamil kamil 465135 Nov 26 19:15 .outline.pdf
-rw------- 1 kamil kamil 465135 Nov 26 19:13 outline.pdf

As you can see number of special shell characters are used, such as the tilde character (<code>~</code>), which in shell points to the home directory of the current user, the minus character (<code>-</code>), which is used for escaping command options for shell programs as well as in IO redirection, and the dot character (<code>.</code>) that stands for the current directory. Now lets try to apply a file operation to all of these files in a typical way. More specifically, lets make these files readable by everyone using the following command


chmod a+r *.pdf

The above command fails with the following error message.

chmod: invalid mode: `-outline.pdf'
Try `chmod --help' for more information.

So, the <code>chmod</code> operation fails because the minus in the <code>-outline.pdf</code> filename is considered a mode switch, with a non-existent mode: <code>outline.pdf</code>. Out of the above files, <code>-outline.pdf</code>, is the only file that causes problems since running the following command works fine.


chmod a+r ~outline.pdf .outline.pdf outline.pdf ~&#92; outline.pdf

This is shown in the output below.

total 2308
drwx------ 2 kamil kamil   4096 Nov 26 19:17 .
drwx------ 3 kamil kamil   4096 Nov 26 19:13 ..
-rw-r--r-- 1 kamil kamil 465135 Nov 26 19:14 ~ outline.pdf
-rw-r--r-- 1 kamil kamil 465135 Nov 26 19:16 ~outline.pdf
-rw------- 1 kamil kamil 465135 Nov 26 19:15 -outline.pdf
-rw-r--r-- 1 kamil kamil 465135 Nov 26 19:15 .outline.pdf
-rw-r--r-- 1 kamil kamil 465135 Nov 26 19:13 outline.pdf

Note, that in the above command the space in the <code>~ outline.pdf</code> filename was escaped using the backslash (\) character, otherwise the <code>chmod a+r</code> operation would be applied to the home directory (~) and the <code>outline.pdf</code> file, instead of the <code>~ outline.pdf</code> file.

So how to get around the leading minus in filenames under Linux shell? Well it is simple, you just have to make sure that there are no leading minuses in the file names. How is that accomplished? By specifying filenames with leading paths. In our example with the current directory, hence the following command would make all the files readable for all the users.

chmod a+r ./*.pdf

In the above command, by pre-pending a <code>./</code> to the <code>*.pdf</code> wild card string we eliminate the problem previously caused by the minus. This is because the minus is no longer the leading character in any of the filenames. Instead, all of the files passed to the <code>chmod a+r</code> command begin with <code>./</code> string. To change permissions on the <code>- outline.pdf</code> file alone the following command can be used.

chmod a+r ./-outline.pdf
« Last Edit: April 21, 2008, 23:08 by sam »
- sam | @starrydude --


Show unread posts since last visit.
Sponsor for PC Pals Forum