This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
user:mp010784:start [2016/04/25 14:45] – mp010784 | user:mp010784:start [2016/05/12 17:18] (current) – [Installing and Setting up a Samba Server] mp010784 | ||
---|---|---|---|
Line 1: | Line 1: | ||
****Matthew Page's Wiki**** | ****Matthew Page's Wiki**** | ||
+ | ~~TOC~~ | ||
====Installing and Setting up a Samba Server==== | ====Installing and Setting up a Samba Server==== | ||
- | Something something dark side.\\ | + | There are several steps one must take in order to effectively set up and configure a fully functioning Samba Server.\\ |
+ | |||
+ | 1) The first step is going to be getting the physical machine and hard ware to use for the sambas server. | ||
+ | |||
+ | 2) For the second step one needs to format and partition the hard drives(s) on the desired machine in preparation for installation an operating system< I'm thinking Debian Linux, but any Linux distribution is capable of performing such tasks. | ||
+ | [[https:// | ||
+ | |||
+ | Once you have the iso file downloaded you, for simplicity sake I'm going to call it debian.iso when in reality it might be something more like debian-8.4.0-amd64.iso or something to that effect. On a Windows machine you would need to have some kind of software to write an image to a disc like a CD or DVD, or software to write the image to a USB drive as an installer flash drive. | ||
+ | < | ||
+ | sudo fdisk -l | ||
+ | </ | ||
+ | to locate the USB drive as I normally don't have anything extraneous left plugged into my machines. | ||
+ | |||
+ | < | ||
+ | sudo dd bs=4M if=/ | ||
+ | </ | ||
+ | |||
+ | If this is successful you should have a bootable USB drive. | ||
+ | |||
+ | Then simply rebooting and following the guided installation as most Linux distributions typically have, you can finish up the basic vanilla installation and set a root password and install the bootloader to /dev/sda on the new samba server machine.\\ | ||
+ | |||
+ | 3) Now that the new machine should have a bootable functioning bare bones Debian Linux system on it, we need to install the samba server software and maybe the samba client software. | ||
+ | |||
+ | < | ||
+ | sudo apt-get install samba smbclient | ||
+ | </ | ||
+ | |||
+ | That is pretty much it for basic installation of Samba File Server services onto this system all that remains is to configure the samba server to your desires and needs for the file server.\\ | ||
+ | |||
+ | 4) Configure samba. | ||
+ | < | ||
+ | |||
+ | [global] | ||
+ | workgroup = SIMPLE | ||
+ | [test] | ||
+ | comment = For testing only, please | ||
+ | path = / | ||
+ | read only = no | ||
+ | guest ok = yes | ||
+ | |||
+ | </ | ||
+ | |||
+ | Some additional documentation about the Samba configuration: | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | And for no apparent reason, this one man band guy playing "No Woman, No Cry": | ||
+ | |||
+ | {{youtube> | ||
+ | |||
+ | ====Summer of code 2016 plans and shared tmux sessions==== | ||
+ | After seeing this semester' | ||
+ | {{https:// | ||
+ | |||
+ | Also Tyler and my project, the manage script, located here on github: {{https:// | ||
+ | |||
+ | Tyler and I were talking about keeping our coding chops sharp this summer by working together on something over the summer. | ||
+ | < | ||
+ | $ telnet spoonbomb.com | ||
+ | </ | ||
+ | into my server but Im not sure if I have new user registration set up right and I don;t even know imost of the configuration settings so I;m going to have to look into it. | ||
+ | |||
+ | Another thing Tyler and I want to do over the summer is assuming that I get the prize money for winnign teh Sustainability Fair thing, then I know we both were gonna pick up some Raspberry Pi's adn Tyler mentioned an interest in learning some Python programming to go with it, I have some exposure to python from before I came back to CCC but I'm pretty stale with it so we both might venture down that path too over the summer. | ||
+ | |||
+ | So Tyler and I made a repository to work on our summer coding at {{https:// | ||
+ | |||
+ | I also successfully got us to share a regular tmux session which I had attempted to do earlier in the semester unsuccessfully but I think it was because I made the socket in my own personal home directory as in this case I put it someplace neutral like /tmp folder. | ||
+ | |||
+ | So to do this I created a new tmux session with in /tmp called par with:\\ | ||
+ | < | ||
+ | tmux -S /tmp/pair | ||
+ | </ | ||
+ | |||
+ | Which immediately puts me in the newly created tmux session which I have to extend the persmissions on for Tyler and I to share the session, so I run:\\ | ||
+ | < | ||
+ | sudo chmod 777 /tmp/pair | ||
+ | </ | ||
+ | |||
+ | Tyler also has to have a valid account on the machien which I made one called nullist as he wanted on my webserver for him. I also have the tendency to use a couple lines on my / | ||
+ | < | ||
+ | PermitRootLogin no | ||
+ | AllowUsers robgraves | ||
+ | </ | ||
+ | so I had to add Tyler to the whitelisted users like:\\ | ||
+ | < | ||
+ | PermitRootLogin no | ||
+ | AllowUsers robgraves nullist | ||
+ | </ | ||
+ | Then I had to restart the ssh daemon, which depending on which machine I did it on was either:\\ | ||
+ | < | ||
+ | sudo service ssh restart | ||
+ | </ | ||
+ | Or:\\ | ||
+ | < | ||
+ | sudo /etc/init.d ssh restart | ||
+ | </ | ||
+ | Then Tyler can now login remotely over ssh by using the command, being that I'm using a much higher port number than ssh's default 22 you have to specify it as such like:\\ | ||
+ | < | ||
+ | ssh nullist@www.spoonbomb.com -p PORTNUMBER | ||
+ | </ | ||
+ | The general form for ssh' | ||
+ | < | ||
+ | ssh USERNAME@HOSTNAMEorIPADDRESS -p PORTNUMBER | ||
+ | </ | ||
+ | After that Tyler was securely logged into my machine, all he needed to do then was attach to the previously created tmux socket that was put in a neutral location and opened up permissions with:\\ | ||
+ | < | ||
+ | tmux -S /tmp/pair attach | ||
+ | </ | ||
+ | Now we both had control over the same terminal and we coudl also chat over the terminal as is refelected by my bash history...probably not the best way to communicate, | ||
+ | |||
+ | ==== Playing around with GDB==== | ||
+ | |||
+ | After taking Data Structures I wanted to learn more about gdb and I went out seeking books or websites that taught how to use gdb in more detail. | ||
+ | |||
+ | One fo the first things this book had me do was create a Hello World program with a loop in C as seen below:\\ | ||
+ | |||
+ | < | ||
+ | #include < | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | int i; | ||
+ | for(i=0; | ||
+ | { | ||
+ | printf(" | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Then we compile the code with debugging symbols: | ||
+ | |||
+ | < | ||
+ | gcc -g firstprog.c | ||
+ | </ | ||
+ | |||
+ | which creates the executable a.out file which when run generates on the command line the output:\\ | ||
+ | |||
+ | < | ||
+ | ╭─robgraves@arrakis ~ | ||
+ | ╰─➤ | ||
+ | ╭─robgraves@arrakis ~ | ||
+ | ╰─➤ | ||
+ | ╭─robgraves@arrakis ~ | ||
+ | ╰─➤ | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | Hello, World! | ||
+ | ╭─robgraves@arrakis ~ | ||
+ | ╰─➤ | ||
+ | </ | ||
+ | |||
+ | Then you can load up the program in gdb using the -q option to suppress all the startup messages from gdb:\\ | ||
+ | |||
+ | < | ||
+ | gdb -q ./a.out | ||
+ | </ | ||
+ | |||
+ | which should bring us to a gdb prompt that looks like:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | Then we run:\\ | ||
+ | < | ||
+ | (gdb)list | ||
+ | </ | ||
+ | |||
+ | which shows us the code in our program and then run disassemble main:\\ | ||
+ | |||
+ | < | ||
+ | disassemble main | ||
+ | </ | ||
+ | |||
+ | which shows us the assembly for our code for this build. | ||
+ | |||
+ | < | ||
+ | # | ||
+ | |||
+ | set disassembly intel | ||
+ | #set disassembly att | ||
+ | </ | ||
+ | |||
+ | which this is actually all that I have in my .gdbinit file.\\ | ||
+ | |||
+ | The resulting output from the list commadn and disassemble main in gdb appears as:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) list | ||
+ | 1 #include < | ||
+ | 2 | ||
+ | 3 int main() | ||
+ | 4 { | ||
+ | 5 int i; | ||
+ | 6 for(i=0; i < 10; i++) | ||
+ | 7 { | ||
+ | 8 printf(" | ||
+ | 9 } | ||
+ | 10 } | ||
+ | (gdb) disassemble main | ||
+ | Dump of assembler code for function main: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | End of assembler dump. | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | Now we set a breakpoint at main by running: | ||
+ | |||
+ | < | ||
+ | break main | ||
+ | </ | ||
+ | |||
+ | then we run the program with:\\ | ||
+ | |||
+ | < | ||
+ | run | ||
+ | </ | ||
+ | |||
+ | At this point the book tells me to run (gdb)info register eip , which ends up spitting an error stating invalid register " | ||
+ | |||
+ | So then I run from my machine with the discrepency solved:\\ | ||
+ | < | ||
+ | (gdb)info register rip | ||
+ | </ | ||
+ | |||
+ | Which works and gives me the info in the current instruction pointer register which looks like this:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) run | ||
+ | Starting program: / | ||
+ | |||
+ | Breakpoint 1, main () at firstprog.c: | ||
+ | 6 for(i=0; i < 10; i++) | ||
+ | (gdb) info register eip | ||
+ | Invalid register `eip' | ||
+ | (gdb) info register rip | ||
+ | rip 0x400535 0x400535 < | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | A shortcut for this command is "i r rip" for "info register rip" in addition we can examine the given address. | ||
+ | |||
+ | < | ||
+ | (gdb) info register rip | ||
+ | rip 0x400535 0x400535 < | ||
+ | (gdb) i r rip | ||
+ | rip 0x400535 0x400535 < | ||
+ | (gdb) x/o 0x400535 | ||
+ | 0x400535 < | ||
+ | (gdb) x/o $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/x $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/u $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/t $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/2x | ||
+ | 0x400539 < | ||
+ | (gdb) x/2x $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/12x $rip | ||
+ | 0x400535 < | ||
+ | 0x400545 < | ||
+ | 0x400555: | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | We can also examine the info by b for a single byte, h for a halfword which is two bytes, or w for a word, or g for a giant which is 8 bytes:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) x/8xb $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/8xh $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/8xw $rip | ||
+ | 0x400535 < | ||
+ | 0x400545 < | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | You can also go on to examine the instructions at the register with x/i or multiples say with x/3i:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400535 < | ||
+ | (gdb) x/3i $rip | ||
+ | => 0x400535 < | ||
+ | | ||
+ | | ||
+ | (gdb) x/7xb $rip | ||
+ | 0x400535 < | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400535 < | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | The book has me play around with some of the info at the registers a little more, most notibly is the nexti command which seems to move to the next instruction: | ||
+ | |||
+ | < | ||
+ | (gdb) x i rbp | ||
+ | A syntax error in expression, near `rbp' | ||
+ | (gdb) i r rbp | ||
+ | rbp 0x7fffffffe5e0 0x7fffffffe5e0 | ||
+ | (gdb) x/4xb $rbp - 4 | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) x/4xb 0x7fffffffe5dc | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) print $rbp -4 | ||
+ | $1 = (void *) 0x7fffffffe5dc | ||
+ | (gdb) x/4xb $1 | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) x/xw $1 | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) nexti | ||
+ | 0x000000000040053c 6 | ||
+ | (gdb) x/4xb $1 | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) x/dw $1 | ||
+ | 0x7fffffffe5dc: | ||
+ | (gdb) i r rip | ||
+ | rip 0x40053c 0x40053c < | ||
+ | (gdb) x/i $rip | ||
+ | => 0x40053c < | ||
+ | (gdb) x/10i $rip | ||
+ | => 0x40053c < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | Then moving further along in the intructions: | ||
+ | |||
+ | < | ||
+ | (gdb) nexti | ||
+ | 0x000000000040054c 6 | ||
+ | (gdb) x/i $rip | ||
+ | => 0x40054c < | ||
+ | (gdb) nexti | ||
+ | 0x0000000000400550 6 | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400550 < | ||
+ | (gdb) nexti | ||
+ | 8 printf(" | ||
+ | (gdb) i r rip | ||
+ | rip 0x40053e 0x40053e < | ||
+ | (gdb) x/2i $rip | ||
+ | => 0x40053e < | ||
+ | | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | Then we look at the stack pointer at rsp register: | ||
+ | |||
+ | < | ||
+ | (gdb) i r rdi | ||
+ | rdi 0x1 1 | ||
+ | (gdb) i r rsp | ||
+ | rsp 0x7fffffffe5d0 0x7fffffffe5d0 | ||
+ | (gdb) x/2xw 0x4005e4 | ||
+ | 0x4005e4: | ||
+ | (gdb) x/6xb 0x4005e4 | ||
+ | 0x4005e4: | ||
+ | (gdb) x/6ub 0x4005e4 | ||
+ | 0x4005e4: | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | The above 6 units in hex or in decimal are the ASCII values for " | ||
+ | |||
+ | < | ||
+ | (gdb) x/6cb 0x4005e4 | ||
+ | 0x4005e4: | ||
+ | (gdb) x/s 0x4005e4 | ||
+ | 0x4005e4: | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | And we continue on:\\ | ||
+ | |||
+ | < | ||
+ | (gdb) x/2i $rip | ||
+ | => 0x40053e < | ||
+ | | ||
+ | (gdb) x/xw $rip | ||
+ | 0x40053e < | ||
+ | (gdb) nexti | ||
+ | 0x0000000000400543 8 | ||
+ | (gdb) x/xw $esp | ||
+ | 0xffffffffffffe5d0: | ||
+ | (gdb) x/xw $rsp | ||
+ | 0x7fffffffe5d0: | ||
+ | (gdb) x/i rip | ||
+ | No symbol " | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400543 < | ||
+ | (gdb) nexti | ||
+ | Hello, World! | ||
+ | 6 for(i=0; i < 10; i++) | ||
+ | (gdb) x/2i $rip | ||
+ | => 0x400548 < | ||
+ | | ||
+ | (gdb) | ||
+ | </ | ||
+ | |||
+ | I'm gonna pretty much end here as this is where I'm starting to trail off, but I found doing this to be interesting and want to keep digging down this rabbit hole.\\ | ||
+ | |||
+ | < | ||
+ | (gdb) nexti | ||
+ | 0x0000000000400543 8 | ||
+ | (gdb) x/xw $esp | ||
+ | 0xffffffffffffe5d0: | ||
+ | (gdb) x/xw $rsp | ||
+ | 0x7fffffffe5d0: | ||
+ | (gdb) x/i rip | ||
+ | No symbol " | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400543 < | ||
+ | (gdb) nexti | ||
+ | Hello, World! | ||
+ | 6 for(i=0; i < 10; i++) | ||
+ | (gdb) x/2i $rip | ||
+ | => 0x400548 < | ||
+ | | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400548 < | ||
+ | (gdb) x/dw $eax | ||
+ | 0xe: Cannot access memory at address 0xe | ||
+ | (gdb) x/dw $rax | ||
+ | 0xe: Cannot access memory at address 0xe | ||
+ | (gdb) x/dw $rbp | ||
+ | 0x7fffffffe5e0: | ||
+ | (gdb) nexti | ||
+ | 0x000000000040054c 6 | ||
+ | (gdb) x/dw $rbp | ||
+ | 0x7fffffffe5e0: | ||
+ | (gdb) x/dw $eax | ||
+ | 0xe: Cannot access memory at address 0xe | ||
+ | (gdb) x/i $rip | ||
+ | => 0x40054c < | ||
+ | (gdb) nexti | ||
+ | 0x0000000000400550 6 | ||
+ | (gdb) x/dw $eax | ||
+ | 0xe: Cannot access memory at address 0xe | ||
+ | (gdb) x/i $rip | ||
+ | => 0x400550 < | ||
+ | (gdb) disass main | ||
+ | Dump of assembler code for function main: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | => 0x0000000000400550 < | ||
+ | | ||
+ | | ||
+ | End of assembler dump. | ||
+ | (gdb) list | ||
+ | 1 #include < | ||
+ | 2 | ||
+ | 3 int main() | ||
+ | 4 { | ||
+ | 5 int i; | ||
+ | 6 for(i=0; i < 10; i++) | ||
+ | 7 { | ||
+ | 8 printf(" | ||
+ | 9 } | ||
+ | 10 } | ||
+ | (gdb) | ||
+ | |||
+ | </ | ||
+ | |||
+ | Maybe over the summer I'll more time to delve into this hacking book abit more and see what else I can experiment with.\\ | ||
+ | |||
+ | Some Old Stuff - Something something dark side.\\ | ||
<WRAP info>The real wiki will go above all the video jazz.</ | <WRAP info>The real wiki will go above all the video jazz.</ | ||
Line 24: | Line 529: | ||
Link back to working resume since I can't find another location for it: [[user: | Link back to working resume since I can't find another location for it: [[user: | ||
+ |