Author Topic: Noobie help required.  (Read 3397 times)

0 Members and 1 Guest are viewing this topic.

Offline ArdenUK

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Noobie help required.
« on: December 01, 2015, 11:53:52 pm »
Good evening all,

This is my first post so I apologies if I am asking something which has being asked numerous times. 

Basically I have applied for a new job role which requires networking (cisco security) and linux skills.  I have the required Cisco skills but I am a total noobie regarding Linux (something I am soon to remedy,).  All that being said I have being given a technical challenge regarding Linux to complete, the Operation Director has stated that even though I don't know Linux he would like me to research the answers and complete.

Given the above would anyone have a few moments to give some advise/assistance with some basic Linux commands? I have essentially googled a few of the simpler ones, which I was advised to do but I am running into a bit of trouble with the more "complex" commands.

Kind Regards

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #1 on: December 02, 2015, 12:18:23 am »
Hi ArdenUK, and welcome to the forum :)

Why not post the questions and see if anyone will explain them .. I would think that's more likely to elicit responses than asking for help without saying what you want help with ;)

I for example don't know whether to respond, as I don't yet know if I'm able to help.
« Last Edit: December 02, 2015, 12:21:04 am by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline ArdenUK

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #2 on: December 02, 2015, 12:28:30 am »
Thank you for the warm welcome, Here is a sample! I'll drop it on you all slowly lol.

1.) Using one command, change the mode bits of the text file to look like this: -rwxrw--w-.



2.) Explain the permissions on the file shown below:

   [james@HaPPi Linux]$ ls -l LinuxChallenge
   -rwsrwsrwx. 1 james james 65 Apr  2 12:49 LinuxChallenge



3.) What are the risks of having a file with these permissions?



4.) Using bash commands, replace the contents of the file "LinuxChallenge" with the text below:

<text>
one    four    seven
two    five    eight
three    six    nine
</text>
« Last Edit: December 02, 2015, 12:55:02 am by ArdenUK »

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #3 on: December 02, 2015, 01:26:35 am »
For the first 3 questions this might help you get your head around "linux/unix file permissions":
http://www.onlineconversion.com/html_chmod_calculator.htm

Answers:-

1)
Code: [Select]
chmod 762 /path/to/file
(see the link above, and I'm sure you'll work it out)
-rwxrw--w-
rwx = read/write/execute = 7     <-- OWNER permissions
rw- = read/write = 6     <-- GROUP permissions
-w- = write = 2     <-- EVERYONE ELSE permissions



2) I don't know where the 2 "s" are coming from, but assuming that's supposed to read -rwxrwxrwx

the first "-" digit (-rwxrwxrwx) means it's a file, other options would be "d" for a directory, or "l" for a link (aka. symlnk/shortcut)

the next 3 digits (-rwxrwxrwx) are the permissions for the file "owner" (owner = james) .. rwx = 7 = he has permission to read/write/execute the file.

the next 3 digits (-rwxrwxrwx) are the permissions for the file "group" (group = james) .. rwx = 7 = anyone that belongs to the group assigned to the file has permission to read/write/execute the file.

the next 3 digits (-rwxrwxrwx) are the permissions for "everyone else" .. rwx = 7 = everyone has permission to read/write/execute the file



3) Because EVERYONE has permission the read/write/execute the file, it could (depending on what it is) be considered a security risk .. particularly if it's executable (but also if you just want to keep it private, or make it public but not editable by anyone else).



4)
Code: [Select]
echo -e "one    four    seven\n""two    five    eight\n""three    six    nine" > LinuxChallenge
you can see the echo options at the bottom of this page:
http://www.tecmint.com/echo-command-in-linux/
where you can see \n = new line

BTW,
>
means write it to the file (overwriting what's already there)
but
>>
means append it to the end of the file (without overwriting what's already there).
« Last Edit: December 02, 2015, 10:58:51 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline ArdenUK

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #4 on: December 02, 2015, 11:09:40 pm »
Thank you again!

5.) Make a directory called "CHALLENGE"

I believe this is just mkdir Challenge

6.) Within that directory, create a text file with the name "LinuxChallenge"


7.) Copy the text below into that file: (preferably using bash commands)

<text>
<3 Archer Quotes

Do you want ants? because that's how you get ants!

Nope nope nope nope nope nope nope... you don't want to do that.

Do you think this is a game?
No, I think Jenga is a game.

Lana. Lana? Lana! LANAAAAAA!
What?
....Danger zone
</text>



8.) Using bash commands, remove all '.' characters from the above text


9.) Using bash commands, replace all '!' characters with '.' characters


10.) Using bash commands, search for all lines in the text file which have the '?' character in them.

   The output should look like:
      
      Do you want ants? because that's how you get ants!
      Do you think this is a game?
      Lana. Lana? Lana! LANAAAAAA!
      What?      


Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #5 on: December 03, 2015, 12:23:31 am »
5.) to create a folder called "CHALLENGE" in your home folder
Code: [Select]
mkdir ~/CHALLENGE



6.)
Code: [Select]
touch ~/CHALLENGE/LinuxChallenge



7.) dunno if this is what they expect, but it would work:
Code: [Select]
echo -e "<3 Archer Quotes""\n\n""Do you want ants? because that's how you get ants!""\n\n""Nope nope nope nope nope nope nope... you don't want to do that.""\n\n""Do you think this is a game?""\n""No, I think Jenga is a game.""\n\n""Lana. Lana? Lana! LANAAAAAA!""\n""What?""\n""....Danger zone" > ~/CHALLENGE/LinuxChallenge



8.)
Code: [Select]
sed -i -e 's/\.//g' ~/CHALLENGE/LinuxChallenge



9.)
Code: [Select]
sed -i -e 's/!/./g' ~/CHALLENGE/LinuxChallenge



10.)
Code: [Select]
cat ~/CHALLENGE/LinuxChallenge | grep ?
« Last Edit: December 03, 2015, 03:16:39 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline donwatson

  • Hero Member
  • *****
  • Posts: 991
  • Karma: 9
  • Gender: Male
  • Getting older
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #6 on: December 03, 2015, 11:01:17 am »
Hi Mark,
I see in item

6.)
Code: [Select]
touch ~/CHALLANGE/LinuxChallenge

If copied and pasted (as usual) it may provide a CHALLANGE too far  :D
Novatech build
Intel Celeron CPU 1.80 Ghz   Memory 4.00GB (3.71GB usable)
Peppermint 9    64 bit     500 GB HD        496 GB Ext 4
4.0GB Swap Partition    4.0GB Extended Partition   1.1Mb Free Space
External 2TiB HD

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #7 on: December 03, 2015, 03:17:04 pm »
typo fixed in (6) above.
« Last Edit: December 08, 2015, 10:37:04 am by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline Finlay

  • Jr. Member
  • **
  • Posts: 5
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #8 on: December 06, 2015, 07:52:05 am »
Forgive my impertinence but for Qu2 & 3 ...
I believe the file attributes are the SETUID bit and SETGID bit.



I will let you Google for why setting the  SETUID bit and SETGID bit can be a security risk, it is a bit of a lengthy explanation.
 

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #9 on: December 06, 2015, 10:22:48 am »
Cheers Finlay, not something I'd come across before .. but something I know now ;)
(actually I knew about setuid and setgid .. I just never realised they showed up in the permissions as "s" and didn't make the connection)

.
« Last Edit: December 06, 2015, 10:52:22 am by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline ArdenUK

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #10 on: December 07, 2015, 05:54:42 pm »
Hi guys,

Thank you for all your assistance in this matter.  Given all your help as well as me epically falling over numerous times on my ubuntu install testing the commands you have supplied I was offered the role at the company.  Goes without saying I could not do this without your support.  Many many thanks!

Regards

Paul!

PS. Given this company works purely with Linux, watch this space for further questions hahaha :)

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #11 on: December 07, 2015, 06:07:58 pm »
Great stuff .. I guess you now have some homework ahead of you :)
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline ArdenUK

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #12 on: December 08, 2015, 09:16:43 am »
More than "some" lol, Have to become competent on CentOS which should be a fun ride ! :)

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: Noobie help required.
« Reply #13 on: December 08, 2015, 10:34:18 am »
Or talk them into switching to Debian ;)

I've never understood why companies like CentOS so much .. all the downsides of Redhat, without the single upside (support) :o
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal