+ Reply to Thread
Page 10 of 10 First ... 678910
Results 226 to 241 of 241
  1. Senior Member
    Join Date
    Feb 2012
    Posts
    2,426
    #226
    Quote Originally Posted by finhack View Post
    how to recover from chmod -x /bin/chmod ?
    Great question! I really liked this one.

    @W Stewart - good answer - I wasn't familiar with that command.

    What's neat about this question is that I bet there are several ways to do it depending on your background. The 2 solutions that I thought of is not as simple as using setfacl.

    I am wondering if there are shell built-ins that can be used to solve this as well.

    My own idea was the following:

    1) Write your own quick app to turn on the execute bit
    Code:
    #include <sys/stat.h>
    
    main()
    {
      chmod ("/bin/chmod", S_IRWXU|S_IRGRP|S_IXGRP);  
    }
    That will turn on the execute bit and then you can use /bin/chmod.

    or

    2) Call the ELF loader directly on /bin/chmod to fix the execute bit. Something like this:

    /lib/ld-linux-x86-64.so.2 /bin/chmod +x /bin/chmod
    Reply With Quote Quote  

  2. SS -->
  3. Junior Member
    Join Date
    Apr 2014
    Posts
    12

    Certifications
    LPIC-3, RHCE
    #227
    nice answers,

    another one:

    What would this command do? (and no, don't try it on production)


    :(){ :|: & };:
    Reply With Quote Quote  

  4. Senior Member W Stewart's Avatar
    Join Date
    Jun 2011
    Location
    Tampa, FL
    Posts
    786

    Certifications
    Bachelor of Science IT - Security, CCNA Security, CCNA R&S, LPIC-1, A+ Net+ Sec+, Linux+ and others I don't feel are worth mentioning
    #228
    That's a fork bomb. It will run a function called : which calls itself and then pipes the output into another call of itself and runs in the background. It will keep spawning more recursive functions until every instance is killed, the system is rebooted or the system runs out of resources.
    Reply With Quote Quote  

  5. Senior Member W Stewart's Avatar
    Join Date
    Jun 2011
    Location
    Tampa, FL
    Posts
    786

    Certifications
    Bachelor of Science IT - Security, CCNA Security, CCNA R&S, LPIC-1, A+ Net+ Sec+, Linux+ and others I don't feel are worth mentioning
    #229
    Which command can I use on a redhat based system to find the dependencies of a package?
    Reply With Quote Quote  

  6. Junior Member
    Join Date
    Apr 2014
    Posts
    12

    Certifications
    LPIC-3, RHCE
    #230
    rpm -qpR
    Which command will prevent users from exiting a shell script using ctrl c or ctrl z?
    Reply With Quote Quote  

  7. Senior Member W Stewart's Avatar
    Join Date
    Jun 2011
    Location
    Tampa, FL
    Posts
    786

    Certifications
    Bachelor of Science IT - Security, CCNA Security, CCNA R&S, LPIC-1, A+ Net+ Sec+, Linux+ and others I don't feel are worth mentioning
    #231
    the trap command with signals 2 and 20
    Reply With Quote Quote  

  8. Senior Member ChooseLife's Avatar
    Join Date
    Feb 2011
    Location
    runlevel 3
    Posts
    926

    Certifications
    BCSc Network Security, VCP, MCSA:Sec, CCNA:Sec, GIAC GSEC, Sec+, ITIL-f
    #232
    Let's revive this thread, shall we?

    Question: How can you tell uptime of a system, without issuing "uptime" command?
    Reply With Quote Quote  

  9. Senior Member Expect's Avatar
    Join Date
    Jul 2013
    Location
    Canada
    Posts
    247
    #233
    Quote Originally Posted by ChooseLife View Post
    Let's revive this thread, shall we?

    Question: How can you tell uptime of a system, without issuing "uptime" command?
    top -n 1 | head -1

    Question: how can you add timestamps to the history command output?
    Last edited by Expect; 03-09-2015 at 08:14 AM.
    Reply With Quote Quote  

  10. Senior Member ChooseLife's Avatar
    Join Date
    Feb 2011
    Location
    runlevel 3
    Posts
    926

    Certifications
    BCSc Network Security, VCP, MCSA:Sec, CCNA:Sec, GIAC GSEC, Sec+, ITIL-f
    #234
    Quote Originally Posted by Expect View Post
    top -n 1 | head -1
    How else? I am not looking for a command that readily prints the uptime (i.e. no "uptime", no "top, no "w", etc)
    Last edited by ChooseLife; 03-09-2015 at 09:21 PM.
    Reply With Quote Quote  

  11. The whole Shebang! hiddenknight821's Avatar
    Join Date
    Aug 2009
    Location
    Western NY
    Posts
    1,175

    Certifications
    BS: IT-Security, AAS: Applied Computer Technology, CompTIA Trios, Project+, CCNA: Security (Expired), RHCSA
    #235
    Quote Originally Posted by Expect View Post
    Question: how can you add timestamps to the history command output?
    GREAT QUESTION! I kept the honor code, and try not to refer to Google or the like, and I was able to figure out the answer after spending an hour on this. As always, the answer is in the man page of bash since history is bash built-in command. I had to change the HISTTIMEFORMAT variable. Yet, I didn't know how to manipulate it until the man referred me to the third section of strftime man page, which helped me arrive at the answer.

    I like the format below. It's more readable:
    %D' '%I:%M:%S' '%P' '%Z': '
    Reply With Quote Quote  

  12. Senior Member Expect's Avatar
    Join Date
    Jul 2013
    Location
    Canada
    Posts
    247
    #236
    Quote Originally Posted by ChooseLife View Post
    How else? I am not looking for a command that readily prints the uptime (i.e. no "uptime", no "top, no "w", etc)
    files under /proc are created on boot so their creation date is the same as the uptime of the system
    e.g.:

    Code:
    dolev@ubuntu:~$ stat /proc/uptime 
      File: ‘/proc/uptime’
      Size: 0             Blocks: 0          IO Block: 1024   regular empty file
    Device: 3h/3d    Inode: 4026532042  Links: 1
    Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2015-03-10 06:02:04.864524011 +0200
    Modify: 2015-03-10 06:02:04.864524011 +0200
    Change: 2015-03-10 06:02:04.864524011 +0200
     Birth: -
    Reply With Quote Quote  

  13. Senior Member Expect's Avatar
    Join Date
    Jul 2013
    Location
    Canada
    Posts
    247
    #237
    Quote Originally Posted by hiddenknight821 View Post
    GREAT QUESTION! I kept the honor code, and try not to refer to Google or the like, and I was able to figure out the answer after spending an hour on this. As always, the answer is in the man page of bash since history is bash built-in command. I had to change the HISTTIMEFORMAT variable. Yet, I didn't know how to manipulate it until the man referred me to the third section of strftime man page, which helped me arrive at the answer.

    I like the format below. It's more readable:
    %D' '%I:%M:%S' '%P' '%Z': '
    good work,

    Question: how can you create an iptables firewall rule related to an already established connection?
    Reply With Quote Quote  

  14. Senior Member ChooseLife's Avatar
    Join Date
    Feb 2011
    Location
    runlevel 3
    Posts
    926

    Certifications
    BCSc Network Security, VCP, MCSA:Sec, CCNA:Sec, GIAC GSEC, Sec+, ITIL-f
    #238
    Quote Originally Posted by Expect View Post
    files under /proc are created on boot so their creation date is the same as the uptime of the system
    e.g.:

    Code:
    dolev@ubuntu:~$ stat /proc/uptime 
      File: ‘/proc/uptime’
      Size: 0             Blocks: 0          IO Block: 1024   regular empty file
    Device: 3h/3d    Inode: 4026532042  Links: 1
    Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2015-03-10 06:02:04.864524011 +0200
    Modify: 2015-03-10 06:02:04.864524011 +0200
    Change: 2015-03-10 06:02:04.864524011 +0200
     Birth: -
    I will take it I was looking for something along the lines of
    Code:
    ps eo lstart -p 1
    but this is same
    Reply With Quote Quote  

  15. Senior Member Expect's Avatar
    Join Date
    Jul 2013
    Location
    Canada
    Posts
    247
    #239
    Quote Originally Posted by ChooseLife View Post
    I will take it I was looking for something along the lines of
    Code:
    ps eo lstart -p 1
    but this is same
    Like the ps solution!
    Reply With Quote Quote  

  16. Senior Member Xavor's Avatar
    Join Date
    Apr 2013
    Location
    Greater DC area, USA
    Posts
    160

    Certifications
    VCP5, RHCSA, Sec+, ITIL
    #240
    misposted, delete pls
    Last edited by Xavor; 03-14-2015 at 02:54 AM.
    Reply With Quote Quote  

  17. Senior Member W Stewart's Avatar
    Join Date
    Jun 2011
    Location
    Tampa, FL
    Posts
    786

    Certifications
    Bachelor of Science IT - Security, CCNA Security, CCNA R&S, LPIC-1, A+ Net+ Sec+, Linux+ and others I don't feel are worth mentioning
    #241
    Haven't been hear in awhile. What does the D status flag in the top command mean?
    Reply With Quote Quote  

+ Reply to Thread
Page 10 of 10 First ... 678910

Social Networking & Bookmarks